{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "9VTl2zW04Bza"
      },
      "source": [
        "# How To Implement Working Memory in AI Applications With Cohere, Tavily and MongoDB\n",
        "\n",
        "<a href=\"https://colab.research.google.com/github/mongodb-developer/GenAI-Showcase/blob/main/notebooks/agents/implementing_working_memory_with_tavily_and_mongodb.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "V3Svkdpvoow-"
      },
      "source": [
        "Memory is the cornerstone on which all forms of intelligence emerge and evolve. It creates the foundation for human cognition and artificial systems to build complex understanding. For humans, memory is a dynamic biological process of encoding, storing, and retrieving information through neural networks, shaping our ability to learn, adapt, and make decisions.\n",
        "\n",
        "For computational systems in the modern AI application landscape, such as LLM-powered chatbots,  AI Agents, and Agentic systems, memory is the foundation for their reliability, performance, and applicability, determining their capacity to maintain context, learn from interactions, and exhibit consistent, intelligent behavior.\n",
        "\n",
        "In this tutorial, we will cover:\n",
        "- Memory in AI Agents and Agentic Systems\n",
        "- How to implement working memory in agentic systems\n",
        "- How to use Tavily and MongoDB to implement working memory\n",
        "- A practical use case: implementing an AI sales assistant with real-time access to internal product catalogs and online information, showcasing working memory's role in personalized recommendations and user interactions.\n",
        "- Benefits of working memory in AI applications in real-time scenarios.\n",
        "\n",
        "Your ability to understand memory from a holistic perspective and the ability to implement various functionalities of memory within computational systems positions you at a critical intersection of cognitive architecture design and practical AI development, making your expertise invaluable as these paradigms increase and become the dominant form factor of modern AI systems.\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "rn0tkS0Q5ENk"
      },
      "source": [
        "## Install libaries and set environment variables"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "Clq2TU_d33FK",
        "outputId": "e9ba7be4-5410-44f2-d0e3-fce9aa34edaf"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m89.9/89.9 kB\u001b[0m \u001b[31m3.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m248.7/248.7 kB\u001b[0m \u001b[31m9.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.4/1.4 MB\u001b[0m \u001b[31m26.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m480.6/480.6 kB\u001b[0m \u001b[31m15.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m13.1/13.1 MB\u001b[0m \u001b[31m22.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m116.3/116.3 kB\u001b[0m \u001b[31m4.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m313.6/313.6 kB\u001b[0m \u001b[31m13.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m3.1/3.1 MB\u001b[0m \u001b[31m16.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m179.3/179.3 kB\u001b[0m \u001b[31m6.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m134.8/134.8 kB\u001b[0m \u001b[31m7.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.2/1.2 MB\u001b[0m \u001b[31m13.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m194.1/194.1 kB\u001b[0m \u001b[31m6.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[?25h\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
            "cudf-cu12 24.10.1 requires pandas<2.2.3dev0,>=2.0, but you have pandas 2.2.3 which is incompatible.\n",
            "gcsfs 2024.10.0 requires fsspec==2024.10.0, but you have fsspec 2024.9.0 which is incompatible.\n",
            "google-colab 1.0.0 requires pandas==2.2.2, but you have pandas 2.2.3 which is incompatible.\u001b[0m\u001b[31m\n",
            "\u001b[0m"
          ]
        }
      ],
      "source": [
        "!pip install --quiet --upgrade tavily-python cohere pymongo datasets pandas"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 2,
      "metadata": {
        "id": "Hb9Ep-T-4zW_"
      },
      "outputs": [],
      "source": [
        "import getpass\n",
        "import os\n",
        "\n",
        "\n",
        "# Function to securely get and set environment variables\n",
        "def set_env_securely(var_name, prompt):\n",
        "    value = getpass.getpass(prompt)\n",
        "    os.environ[var_name] = value"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "NUnsuVnUnxYg"
      },
      "source": [
        "# Step 1 - 5: Creating a knowledge base (long-term memory)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "pcd2Smfno7c4"
      },
      "source": [
        "In this step, the aim is to create a knowledge base consisting of a product accessible by the research assistant via retrieval mechanisms. The retrieval mechanism used in this tutorial is vector search. MongoDB is used as an operational and vector database for the sales assistant's knowledge base. This means we can conduct a semantic search between the vector embeddings of each product generated from concatenated existing product attributes and an embedding of a user’s query passed into the assistant.\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "qz1is3cbnkIg"
      },
      "source": [
        "![image.png]()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "imGK5g7rIc0p"
      },
      "source": [
        "## Step 1: Data Loading"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "T7Oc3DWyo9tj"
      },
      "source": [
        "The process begins with data ingestion into MongoDB. The product data, including attributes like product name, category, description, and technical details, is structured into a pandas DataFrame.\n",
        "\n",
        "The product data used in this example is sourced from the Hugging Face Datasets library using the `load_dataset()` function. Specifically, it is obtained from the \"philschmid/amazon-product-descriptions-vlm\" dataset, which contains a vast collection of Amazon product descriptions and related information.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 3,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 113,
          "referenced_widgets": [
            "3ac0b9d8f1b24766b044efd7061e0e65",
            "9df90dab7338463a899ffcf4d098982f",
            "32ec681e47ca4741b691c2be054cb05d",
            "042dbe05d19e4919967c1366916a583e",
            "4bfaf6a7e6b146588549f31dd5b6fc83",
            "5584ff6199d74edba7e9b6d5ad98ca69",
            "87432b4fc6de43c0b0ac598e045bab74",
            "571ed4dfb9134f6b8b2d82648d7b81d6",
            "2bbab14bd521455fa92486ed73b860c8",
            "98751af9ec044b49bc3500746c368250",
            "51576a1a30c4418dabb6707d892b9c20",
            "c408cf02f8af4954a20e386fab678ea9",
            "e2f8f33832cf44cca1c3183f0f94d62c",
            "9a1a9bfaf4234a0890ea1ab141e689dc",
            "91283d8c4adb4f3ea1939505201a6563",
            "fea121b36bbc48fa9169753b8a510c06",
            "9943caecde394b19b5989fecd20539f2",
            "d70272f6047749fcb47ab329bae024dd",
            "74792adbb4864b21b8fe2f3305406d9c",
            "c9c22ba89f3b41bd90c61335553a52f9",
            "de9f69c89446426eac8497c42bc94c0a",
            "26f07715f73d49ec89c343344f6ac524",
            "26eedaf3e495447096ce07baa240abff",
            "01cc65a3953a4b34b469677d2e4586c1",
            "5ce3e46314a44be4a34ddd923481d565",
            "fcbf37955ff4400291a0d12a207894bf",
            "4a072aadd74c44058b4dda184bf86895",
            "5c4b00ddb5eb4d6b978ee97d645d481b",
            "863c775bee6a47c7b429f813e08803cc",
            "cbefa1f46015406891bdfa2749b3d7a0",
            "252d592fa8824ae4a5b0b1290d16ea2f",
            "5af88ae742284399a8bac4c0918e33ef",
            "1a677d8c742f41199f3722106af9e502"
          ]
        },
        "id": "SknGuSFDIbz4",
        "outputId": "e975dc80-9a75-4ff3-84a0-2d2496cd1650"
      },
      "outputs": [
        {
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "3ac0b9d8f1b24766b044efd7061e0e65",
              "version_major": 2,
              "version_minor": 0
            },
            "text/plain": [
              "README.md:   0%|          | 0.00/1.22k [00:00<?, ?B/s]"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "c408cf02f8af4954a20e386fab678ea9",
              "version_major": 2,
              "version_minor": 0
            },
            "text/plain": [
              "train-00000-of-00001.parquet:   0%|          | 0.00/47.6M [00:00<?, ?B/s]"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "26eedaf3e495447096ce07baa240abff",
              "version_major": 2,
              "version_minor": 0
            },
            "text/plain": [
              "Generating train split:   0%|          | 0/1345 [00:00<?, ? examples/s]"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "import pandas as pd\n",
        "from datasets import load_dataset\n",
        "\n",
        "# Make sure you have an HF_TOKEN in your environment varibales to access dataset on hugging face\n",
        "product_dataset = load_dataset(\"philschmid/amazon-product-descriptions-vlm\")\n",
        "\n",
        "# Convert product_dataset to pandas dataframe\n",
        "product_dataframe = pd.DataFrame(product_dataset[\"train\"])"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 4,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 643
        },
        "id": "IvFAiSQc5Ugj",
        "outputId": "a67b3258-ce75-477c-b543-2de564ef7e2d"
      },
      "outputs": [
        {
          "data": {
            "application/vnd.google.colaboratory.intrinsic+json": {
              "summary": "{\n  \"name\": \"product_dataframe\",\n  \"rows\": 1345,\n  \"fields\": [\n    {\n      \"column\": \"image\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Uniq Id\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1345,\n        \"samples\": [\n          \"3729b400bb500a9b2259312fdbd1e04f\",\n          \"3123f9557a14299160bde77c2e1900be\",\n          \"ea3ee7f352156915cba99e61ccd5910f\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Product Name\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1345,\n        \"samples\": [\n          \"The Northwest Company Disney Phineas & Ferb Action Agent Character Fleece Throw Blanket, 40 x 50-inches\",\n          \"All About Details CATHE60 Hello 60 Cake, 1pc, 60th Birthday, Party Decor, Glitter Topper (Gold & Black), 6 x 9,\",\n          \"LEGO Marvel Super Heroes Avengers: Infinity War The Hulkbuster: Ultron Edition 76105 Building Kit (1363 Pieces)\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Category\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 362,\n        \"samples\": [\n          \"Sports & Outdoors | Outdoor Recreation | Skates, Skateboards & Scooters | Skateboarding | Protective Gear | Elbow Pads\",\n          \"Toys & Games | Stuffed Animals & Plush Toys\",\n          \"Clothing, Shoes & Jewelry | Costumes & Accessories | Women | Costumes & Cosplay Apparel | Costumes\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Selling Price\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 875,\n        \"samples\": [\n          \"$29.99 - $35.95\",\n          \"$13.62\",\n          \"$21.95\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Model Number\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1123,\n        \"samples\": [\n          \"12-HY2764\",\n          \"CX21823A6BW\",\n          \"-\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"About Product\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1277,\n        \"samples\": [\n          \"100% Polyester | Imported | Hand Wash | Black baseball hat looks like brains are spilling out the top | Wear to top off your zombie and ghoul costume or on its own just for fun | Not just for halloween, wear this slightly scary cap year-around | One size fits teens and adults | Rubies costume has been a world leader in dress-up fun for all ages since 1950\",\n          \"1:72nd Scale WWII Military Aircraft Plastic Model Kit | Livery A: #54 Operational Training Unit, RAF Church Fenton, North Yorkshire, England Dec 1940 Livery B: #600 City of London Squadron, Royal Auxiliary Air Force Manston, Kent, England Aug 1940 | Skill Level: 3 Number of Parts: 156 | Humbrol Paints needed are listed on the outside of the box. | Construction and painting required: yes, glue and paints need to be purchased separately\",\n          \"Make sure this fits by entering your model number. | Easily washes off skin and most fabrics | AP certified non-toxic - Safe for use around all ages | Perfect for schools, day cares, preschools and more | Bright colors are sure to please artists young and old | Easy to pour 16-Ounce bottle\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Product Specification\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1154,\n        \"samples\": [\n          \"ProductDimensions:1.2x13x9.2inches|ItemWeight:9.6ounces|ShippingWeight:9.6ounces(Viewshippingratesandpolicies)|ASIN:B07SR2MS7W|Itemmodelnumber:820650804045|Manufacturerrecommendedage:6yearsandup\",\n          \"ProductDimensions:4.5x9x5.5inches|ItemWeight:5.9ounces|ShippingWeight:5.9ounces(Viewshippingratesandpolicies)|DomesticShipping:ItemcanbeshippedwithinU.S.|InternationalShipping:ThisitemcanbeshippedtoselectcountriesoutsideoftheU.S.LearnMore|ASIN:B0749V8K58|Itemmodelnumber:02496|Manufacturerrecommendedage:3yearsandup\",\n          \"ProductDimensions:6.5x4.1x4.1inches|ItemWeight:2.35pounds|ShippingWeight:2.35pounds(Viewshippingratesandpolicies)|DomesticShipping:ItemcanbeshippedwithinU.S.|InternationalShipping:ThisitemcanbeshippedtoselectcountriesoutsideoftheU.S.LearnMore|ASIN:B00KJB1KSQ|Itemmodelnumber:DTXC3588|Manufacturerrecommendedage:15yearsandup\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Technical Details\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1191,\n        \"samples\": [\n          \"Package Quantity:1 show up to 2 reviews by default Amscan.inc is the largest designer, manufacturer, and distributor of decorated party goods and party accessories in the world, founded in 1947. Our company is also a leading supplier of gifts, home decor, and tabletop products as well as the primary source for gift wrap, gift bags, stationery, and licensed products. Our party offering is comprised of more than 300 innovative party ensembles including tableware, accessories, balloons, novelties, stationery, gift wrap, and decorations. Gifts that inspire and satisfy customer needs. Decorate your party tables with this Fiesta Mini Centerpiece Assortment. These mini centerpieces unfold easily and can be set up on any flat surface. The centerpieces are 5\\\" tall and are very colorful. The centerpieces feature maracas, peppers and a cactus with a sombrero. Perfect for Cinco de Mayo or any Mexican-themed bash. Amscan pledge to provide you the quality product at a reasonable price. If you come in, we will give you the reason to come back. Premium quality, Affordable, Value pack, Easy to use, Best for any party | 1.6 ounces (View shipping rates and policies)\",\n          \"Go to your orders and start the return Select the ship method Ship it! | Go to your orders and start the return Select the ship method Ship it! | The best-selling, interactive Hot Dots Talking Pen has a brand new look! Press the sleek, silver Pen to an answer dot on any Hot Dots or Hot Dots Jr. question for instantaneous visual and audio feedback! With 17 speech and sound effects and fun, flashing lights, the Hot Dots Talking Pen is perfect for independent, self-paced learning, guiding kids through dozens of interactive books, activities, and card sets. The Hot Dots Talking Pen is compatible with all Hot Dots and Hot Dots Jr. sets and requires 2 AAA batteries. | 2.4 ounces (View shipping rates and policies)\",\n          \"Air Dancers inflatable tube man 20ft red custom embroidered with \\u201cGRAND OPENING\\u201d down the center in white lettering. This same message is embroidered on the second side as well. This Air Dancers inflatable tube man is compatible with all 18\\u201d diameter Velcro mount blowers (Blower not included). Spend the extra money to let your customers know what you are promoting.\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Shipping Weight\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 320,\n        \"samples\": [\n          \"2.24 ounces\",\n          \"3.04 pounds\",\n          \"2.5 pounds\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Variants\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 349,\n        \"samples\": [\n          \"https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B07CRV8TGR|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B07CRV975B|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B07CRV5M42|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B01G8UOFAQ|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B00JKQ1AZO|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B07CSWH9WD|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B00C2WZPL8|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B07CRYQFW9\",\n          \"https://www.amazon.com/Poolmaster-Vinyl-Water-Hammock-Blue/dp/B00TQGNJ16|https://www.amazon.com/Poolmaster-Vinyl-Water-Hammock-Blue/dp/B00TQGNJ0W|https://www.amazon.com/Poolmaster-Vinyl-Water-Hammock-Blue/dp/B00TQGNJ66\",\n          \"https://www.amazon.com/Forum-Womens-Flirting-Crinoline-Standard/dp/B012DYPJHO|https://www.amazon.com/Forum-Womens-Flirting-Crinoline-Standard/dp/B013RJ12X4|https://www.amazon.com/Forum-Womens-Flirting-Crinoline-Standard/dp/B00VJ3JDE6\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Product Url\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1345,\n        \"samples\": [\n          \"https://www.amazon.com/Northwest-Company-Phineas-Character-50-inches/dp/B075RGH8CB\",\n          \"https://www.amazon.com/All-About-Details-Birthday-Glitter/dp/B07DP9JRDH\",\n          \"https://www.amazon.com/LEGO-Marvel-Super-Heroes-Avengers/dp/B078W7C8YJ\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Is Amazon Seller\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 2,\n        \"samples\": [\n          \"N\",\n          \"Y\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"description\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1345,\n        \"samples\": [\n          \"Snuggle up with Phineas and Ferb! This super-soft 40x50 inch fleece throw blanket features your favorite Action Agent duo. Perfect for kids' bedrooms, couches, or travel, this Disney blanket offers cozy comfort and vibrant colors.  Machine washable for easy care.\",\n          \"Celebrate their 60th birthday in style! This elegant \\\"Hello 60\\\" cake topper adds a touch of sparkle and sophistication to any 60th birthday cake.  Featuring a glamorous gold and black glitter design (6\\\" x 9\\\"), it's the perfect finishing touch for your party.  Shop now!\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}",
              "type": "dataframe",
              "variable_name": "product_dataframe"
            },
            "text/html": [
              "\n",
              "  <div id=\"df-945931f7-1b33-4cfd-80e9-74bcc31b2360\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>image</th>\n",
              "      <th>Uniq Id</th>\n",
              "      <th>Product Name</th>\n",
              "      <th>Category</th>\n",
              "      <th>Selling Price</th>\n",
              "      <th>Model Number</th>\n",
              "      <th>About Product</th>\n",
              "      <th>Product Specification</th>\n",
              "      <th>Technical Details</th>\n",
              "      <th>Shipping Weight</th>\n",
              "      <th>Variants</th>\n",
              "      <th>Product Url</th>\n",
              "      <th>Is Amazon Seller</th>\n",
              "      <th>description</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>&lt;PIL.JpegImagePlugin.JpegImageFile image mode=...</td>\n",
              "      <td>002e4642d3ead5ecdc9958ce0b3a5a79</td>\n",
              "      <td>Kurio Glow Smartwatch for Kids with Bluetooth,...</td>\n",
              "      <td>Toys &amp; Games | Kids' Electronics | Electronic ...</td>\n",
              "      <td>$31.30</td>\n",
              "      <td>C17515</td>\n",
              "      <td>Make sure this fits by entering your model num...</td>\n",
              "      <td>ProductDimensions:5x3x12inches|ItemWeight:7.2o...</td>\n",
              "      <td>Color:Blue show up to 2 reviews by default Thi...</td>\n",
              "      <td>7.2 ounces</td>\n",
              "      <td>https://www.amazon.com/Kurio-Smartwatch-Blueto...</td>\n",
              "      <td>https://www.amazon.com/Kurio-Smartwatch-Blueto...</td>\n",
              "      <td>Y</td>\n",
              "      <td>Kurio Glow Smartwatch: Fun, Safe &amp; Educational...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>&lt;PIL.JpegImagePlugin.JpegImageFile image mode=...</td>\n",
              "      <td>009359198555dde1543d94568183703c</td>\n",
              "      <td>Star Ace Toys Harry Potter &amp; The Prisoner of A...</td>\n",
              "      <td>None</td>\n",
              "      <td>$174.99</td>\n",
              "      <td>SA8011B</td>\n",
              "      <td>Make sure this fits by entering your model num...</td>\n",
              "      <td>ProductDimensions:2.5x1x9inches|ItemWeight:1.4...</td>\n",
              "      <td>From Star Ace Toys. Many fans would say that H...</td>\n",
              "      <td>1.43 pounds</td>\n",
              "      <td>None</td>\n",
              "      <td>https://www.amazon.com/Star-Ace-Toys-Prisoner-...</td>\n",
              "      <td>Y</td>\n",
              "      <td>Relive the magic!  Star Ace Toys' 1/8 scale Ha...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>&lt;PIL.JpegImagePlugin.JpegImageFile image mode=...</td>\n",
              "      <td>00cb3b80482712567c2180767ec28a6a</td>\n",
              "      <td>Barbie Fashionistas Doll Wear Your Heart</td>\n",
              "      <td>Toys &amp; Games | Dolls &amp; Accessories | Dolls</td>\n",
              "      <td>$15.99</td>\n",
              "      <td>FJF44</td>\n",
              "      <td>Make sure this fits by entering your model num...</td>\n",
              "      <td>ProductDimensions:2.1x4.5x12.8inches|ItemWeigh...</td>\n",
              "      <td>Go to your orders and start the return Select ...</td>\n",
              "      <td>4.2 ounces</td>\n",
              "      <td>None</td>\n",
              "      <td>https://www.amazon.com/Barbie-FJF44-Love-Fashi...</td>\n",
              "      <td>Y</td>\n",
              "      <td>Express your style with Barbie Fashionistas Do...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>&lt;PIL.JpegImagePlugin.JpegImageFile image mode=...</td>\n",
              "      <td>00cce525ebf9181ebfba30dc5ca936fd</td>\n",
              "      <td>Redcat Racing Aluminum Rear Lower Suspension A...</td>\n",
              "      <td>Toys &amp; Games | Hobbies | Remote &amp; App Controll...</td>\n",
              "      <td>$14.40</td>\n",
              "      <td>06049B</td>\n",
              "      <td>Aluminum Rear Lower Suspension Arms, Blue (2pc...</td>\n",
              "      <td>ProductDimensions:1.5x3.5x0.2inches|ItemWeight...</td>\n",
              "      <td>2.4 ounces (View shipping rates and policies) ...</td>\n",
              "      <td>2.4 ounces</td>\n",
              "      <td>None</td>\n",
              "      <td>https://www.amazon.com/Redcat-Racing-Aluminum-...</td>\n",
              "      <td>Y</td>\n",
              "      <td>Upgrade your Redcat Racing vehicle's performan...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>&lt;PIL.JpegImagePlugin.JpegImageFile image mode=...</td>\n",
              "      <td>015cc42a8e93b15bcea9425d63ecbbd9</td>\n",
              "      <td>Tru-Ray Heavyweight Construction Paper Pad, 10...</td>\n",
              "      <td>Arts, Crafts &amp; Sewing | Crafting | Paper &amp; Pap...</td>\n",
              "      <td>$10.10</td>\n",
              "      <td>6592</td>\n",
              "      <td>Make sure this fits by entering your model num...</td>\n",
              "      <td>ASIN:B01ELJGWKW|ShippingWeight:1pounds(Viewshi...</td>\n",
              "      <td>Go to your orders and start the return Select ...</td>\n",
              "      <td>1 pounds</td>\n",
              "      <td>https://www.amazon.com/Tru-Ray-Heavyweight-Con...</td>\n",
              "      <td>https://www.amazon.com/Tru-Ray-Heavyweight-Con...</td>\n",
              "      <td>Y</td>\n",
              "      <td>Unleash your creativity with Tru-Ray Heavyweig...</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-945931f7-1b33-4cfd-80e9-74bcc31b2360')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-945931f7-1b33-4cfd-80e9-74bcc31b2360 button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-945931f7-1b33-4cfd-80e9-74bcc31b2360');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "<div id=\"df-05b7569b-9af6-4328-8c84-ba13c5da4ed6\">\n",
              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-05b7569b-9af6-4328-8c84-ba13c5da4ed6')\"\n",
              "            title=\"Suggest charts\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "  </button>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "      --bg-color: #E8F0FE;\n",
              "      --fill-color: #1967D2;\n",
              "      --hover-bg-color: #E2EBFA;\n",
              "      --hover-fill-color: #174EA6;\n",
              "      --disabled-fill-color: #AAA;\n",
              "      --disabled-bg-color: #DDD;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "      --bg-color: #3B4455;\n",
              "      --fill-color: #D2E3FC;\n",
              "      --hover-bg-color: #434B5C;\n",
              "      --hover-fill-color: #FFFFFF;\n",
              "      --disabled-bg-color: #3B4455;\n",
              "      --disabled-fill-color: #666;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart {\n",
              "    background-color: var(--bg-color);\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: var(--fill-color);\n",
              "    height: 32px;\n",
              "    padding: 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: var(--hover-bg-color);\n",
              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: var(--button-hover-fill-color);\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart-complete:disabled,\n",
              "  .colab-df-quickchart-complete:disabled:hover {\n",
              "    background-color: var(--disabled-bg-color);\n",
              "    fill: var(--disabled-fill-color);\n",
              "    box-shadow: none;\n",
              "  }\n",
              "\n",
              "  .colab-df-spinner {\n",
              "    border: 2px solid var(--fill-color);\n",
              "    border-color: transparent;\n",
              "    border-bottom-color: var(--fill-color);\n",
              "    animation:\n",
              "      spin 1s steps(1) infinite;\n",
              "  }\n",
              "\n",
              "  @keyframes spin {\n",
              "    0% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "      border-left-color: var(--fill-color);\n",
              "    }\n",
              "    20% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    30% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    40% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    60% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    80% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "    90% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "  }\n",
              "</style>\n",
              "\n",
              "  <script>\n",
              "    async function quickchart(key) {\n",
              "      const quickchartButtonEl =\n",
              "        document.querySelector('#' + key + ' button');\n",
              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
              "      try {\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      } catch (error) {\n",
              "        console.error('Error during call to suggestCharts:', error);\n",
              "      }\n",
              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
              "    }\n",
              "    (() => {\n",
              "      let quickchartButtonEl =\n",
              "        document.querySelector('#df-05b7569b-9af6-4328-8c84-ba13c5da4ed6 button');\n",
              "      quickchartButtonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "    })();\n",
              "  </script>\n",
              "</div>\n",
              "\n",
              "    </div>\n",
              "  </div>\n"
            ],
            "text/plain": [
              "                                               image  \\\n",
              "0  <PIL.JpegImagePlugin.JpegImageFile image mode=...   \n",
              "1  <PIL.JpegImagePlugin.JpegImageFile image mode=...   \n",
              "2  <PIL.JpegImagePlugin.JpegImageFile image mode=...   \n",
              "3  <PIL.JpegImagePlugin.JpegImageFile image mode=...   \n",
              "4  <PIL.JpegImagePlugin.JpegImageFile image mode=...   \n",
              "\n",
              "                            Uniq Id  \\\n",
              "0  002e4642d3ead5ecdc9958ce0b3a5a79   \n",
              "1  009359198555dde1543d94568183703c   \n",
              "2  00cb3b80482712567c2180767ec28a6a   \n",
              "3  00cce525ebf9181ebfba30dc5ca936fd   \n",
              "4  015cc42a8e93b15bcea9425d63ecbbd9   \n",
              "\n",
              "                                        Product Name  \\\n",
              "0  Kurio Glow Smartwatch for Kids with Bluetooth,...   \n",
              "1  Star Ace Toys Harry Potter & The Prisoner of A...   \n",
              "2           Barbie Fashionistas Doll Wear Your Heart   \n",
              "3  Redcat Racing Aluminum Rear Lower Suspension A...   \n",
              "4  Tru-Ray Heavyweight Construction Paper Pad, 10...   \n",
              "\n",
              "                                            Category Selling Price  \\\n",
              "0  Toys & Games | Kids' Electronics | Electronic ...        $31.30   \n",
              "1                                               None       $174.99   \n",
              "2         Toys & Games | Dolls & Accessories | Dolls        $15.99   \n",
              "3  Toys & Games | Hobbies | Remote & App Controll...        $14.40   \n",
              "4  Arts, Crafts & Sewing | Crafting | Paper & Pap...        $10.10   \n",
              "\n",
              "  Model Number                                      About Product  \\\n",
              "0       C17515  Make sure this fits by entering your model num...   \n",
              "1      SA8011B  Make sure this fits by entering your model num...   \n",
              "2        FJF44  Make sure this fits by entering your model num...   \n",
              "3       06049B  Aluminum Rear Lower Suspension Arms, Blue (2pc...   \n",
              "4         6592  Make sure this fits by entering your model num...   \n",
              "\n",
              "                               Product Specification  \\\n",
              "0  ProductDimensions:5x3x12inches|ItemWeight:7.2o...   \n",
              "1  ProductDimensions:2.5x1x9inches|ItemWeight:1.4...   \n",
              "2  ProductDimensions:2.1x4.5x12.8inches|ItemWeigh...   \n",
              "3  ProductDimensions:1.5x3.5x0.2inches|ItemWeight...   \n",
              "4  ASIN:B01ELJGWKW|ShippingWeight:1pounds(Viewshi...   \n",
              "\n",
              "                                   Technical Details Shipping Weight  \\\n",
              "0  Color:Blue show up to 2 reviews by default Thi...      7.2 ounces   \n",
              "1  From Star Ace Toys. Many fans would say that H...     1.43 pounds   \n",
              "2  Go to your orders and start the return Select ...      4.2 ounces   \n",
              "3  2.4 ounces (View shipping rates and policies) ...      2.4 ounces   \n",
              "4  Go to your orders and start the return Select ...        1 pounds   \n",
              "\n",
              "                                            Variants  \\\n",
              "0  https://www.amazon.com/Kurio-Smartwatch-Blueto...   \n",
              "1                                               None   \n",
              "2                                               None   \n",
              "3                                               None   \n",
              "4  https://www.amazon.com/Tru-Ray-Heavyweight-Con...   \n",
              "\n",
              "                                         Product Url Is Amazon Seller  \\\n",
              "0  https://www.amazon.com/Kurio-Smartwatch-Blueto...                Y   \n",
              "1  https://www.amazon.com/Star-Ace-Toys-Prisoner-...                Y   \n",
              "2  https://www.amazon.com/Barbie-FJF44-Love-Fashi...                Y   \n",
              "3  https://www.amazon.com/Redcat-Racing-Aluminum-...                Y   \n",
              "4  https://www.amazon.com/Tru-Ray-Heavyweight-Con...                Y   \n",
              "\n",
              "                                         description  \n",
              "0  Kurio Glow Smartwatch: Fun, Safe & Educational...  \n",
              "1  Relive the magic!  Star Ace Toys' 1/8 scale Ha...  \n",
              "2  Express your style with Barbie Fashionistas Do...  \n",
              "3  Upgrade your Redcat Racing vehicle's performan...  \n",
              "4  Unleash your creativity with Tru-Ray Heavyweig...  "
            ]
          },
          "execution_count": 4,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "# Display top 5 rows\n",
        "product_dataframe.head()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "mFjHLYPmKGAh"
      },
      "source": [
        "## Step 2: Data Preparation"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "metadata": {
        "id": "7VCCSf-FKI9A"
      },
      "outputs": [],
      "source": [
        "# Create a new coloumn in the dataset that combines existing coloumns that captures a product semantics\n",
        "product_dataframe[\"product_semantics\"] = product_dataframe.apply(\n",
        "    lambda row: \" \".join(\n",
        "        str(x)\n",
        "        for x in [\n",
        "            row[\"Product Name\"],\n",
        "            row[\"Category\"],\n",
        "            row[\"About Product\"],\n",
        "            row[\"Technical Details\"],\n",
        "            row[\"description\"],\n",
        "        ]\n",
        "        if x\n",
        "    ),\n",
        "    axis=1,\n",
        ")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 6,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 643
        },
        "id": "a_suhMLoJOi6",
        "outputId": "12d181a4-3faf-4946-a492-5497a59acef0"
      },
      "outputs": [
        {
          "data": {
            "application/vnd.google.colaboratory.intrinsic+json": {
              "summary": "{\n  \"name\": \"product_dataframe\",\n  \"rows\": 1345,\n  \"fields\": [\n    {\n      \"column\": \"image\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Uniq Id\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1345,\n        \"samples\": [\n          \"3729b400bb500a9b2259312fdbd1e04f\",\n          \"3123f9557a14299160bde77c2e1900be\",\n          \"ea3ee7f352156915cba99e61ccd5910f\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Product Name\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1345,\n        \"samples\": [\n          \"The Northwest Company Disney Phineas & Ferb Action Agent Character Fleece Throw Blanket, 40 x 50-inches\",\n          \"All About Details CATHE60 Hello 60 Cake, 1pc, 60th Birthday, Party Decor, Glitter Topper (Gold & Black), 6 x 9,\",\n          \"LEGO Marvel Super Heroes Avengers: Infinity War The Hulkbuster: Ultron Edition 76105 Building Kit (1363 Pieces)\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Category\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 362,\n        \"samples\": [\n          \"Sports & Outdoors | Outdoor Recreation | Skates, Skateboards & Scooters | Skateboarding | Protective Gear | Elbow Pads\",\n          \"Toys & Games | Stuffed Animals & Plush Toys\",\n          \"Clothing, Shoes & Jewelry | Costumes & Accessories | Women | Costumes & Cosplay Apparel | Costumes\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Selling Price\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 875,\n        \"samples\": [\n          \"$29.99 - $35.95\",\n          \"$13.62\",\n          \"$21.95\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Model Number\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1123,\n        \"samples\": [\n          \"12-HY2764\",\n          \"CX21823A6BW\",\n          \"-\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"About Product\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1277,\n        \"samples\": [\n          \"100% Polyester | Imported | Hand Wash | Black baseball hat looks like brains are spilling out the top | Wear to top off your zombie and ghoul costume or on its own just for fun | Not just for halloween, wear this slightly scary cap year-around | One size fits teens and adults | Rubies costume has been a world leader in dress-up fun for all ages since 1950\",\n          \"1:72nd Scale WWII Military Aircraft Plastic Model Kit | Livery A: #54 Operational Training Unit, RAF Church Fenton, North Yorkshire, England Dec 1940 Livery B: #600 City of London Squadron, Royal Auxiliary Air Force Manston, Kent, England Aug 1940 | Skill Level: 3 Number of Parts: 156 | Humbrol Paints needed are listed on the outside of the box. | Construction and painting required: yes, glue and paints need to be purchased separately\",\n          \"Make sure this fits by entering your model number. | Easily washes off skin and most fabrics | AP certified non-toxic - Safe for use around all ages | Perfect for schools, day cares, preschools and more | Bright colors are sure to please artists young and old | Easy to pour 16-Ounce bottle\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Product Specification\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1154,\n        \"samples\": [\n          \"ProductDimensions:1.2x13x9.2inches|ItemWeight:9.6ounces|ShippingWeight:9.6ounces(Viewshippingratesandpolicies)|ASIN:B07SR2MS7W|Itemmodelnumber:820650804045|Manufacturerrecommendedage:6yearsandup\",\n          \"ProductDimensions:4.5x9x5.5inches|ItemWeight:5.9ounces|ShippingWeight:5.9ounces(Viewshippingratesandpolicies)|DomesticShipping:ItemcanbeshippedwithinU.S.|InternationalShipping:ThisitemcanbeshippedtoselectcountriesoutsideoftheU.S.LearnMore|ASIN:B0749V8K58|Itemmodelnumber:02496|Manufacturerrecommendedage:3yearsandup\",\n          \"ProductDimensions:6.5x4.1x4.1inches|ItemWeight:2.35pounds|ShippingWeight:2.35pounds(Viewshippingratesandpolicies)|DomesticShipping:ItemcanbeshippedwithinU.S.|InternationalShipping:ThisitemcanbeshippedtoselectcountriesoutsideoftheU.S.LearnMore|ASIN:B00KJB1KSQ|Itemmodelnumber:DTXC3588|Manufacturerrecommendedage:15yearsandup\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Technical Details\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1191,\n        \"samples\": [\n          \"Package Quantity:1 show up to 2 reviews by default Amscan.inc is the largest designer, manufacturer, and distributor of decorated party goods and party accessories in the world, founded in 1947. Our company is also a leading supplier of gifts, home decor, and tabletop products as well as the primary source for gift wrap, gift bags, stationery, and licensed products. Our party offering is comprised of more than 300 innovative party ensembles including tableware, accessories, balloons, novelties, stationery, gift wrap, and decorations. Gifts that inspire and satisfy customer needs. Decorate your party tables with this Fiesta Mini Centerpiece Assortment. These mini centerpieces unfold easily and can be set up on any flat surface. The centerpieces are 5\\\" tall and are very colorful. The centerpieces feature maracas, peppers and a cactus with a sombrero. Perfect for Cinco de Mayo or any Mexican-themed bash. Amscan pledge to provide you the quality product at a reasonable price. If you come in, we will give you the reason to come back. Premium quality, Affordable, Value pack, Easy to use, Best for any party | 1.6 ounces (View shipping rates and policies)\",\n          \"Go to your orders and start the return Select the ship method Ship it! | Go to your orders and start the return Select the ship method Ship it! | The best-selling, interactive Hot Dots Talking Pen has a brand new look! Press the sleek, silver Pen to an answer dot on any Hot Dots or Hot Dots Jr. question for instantaneous visual and audio feedback! With 17 speech and sound effects and fun, flashing lights, the Hot Dots Talking Pen is perfect for independent, self-paced learning, guiding kids through dozens of interactive books, activities, and card sets. The Hot Dots Talking Pen is compatible with all Hot Dots and Hot Dots Jr. sets and requires 2 AAA batteries. | 2.4 ounces (View shipping rates and policies)\",\n          \"Air Dancers inflatable tube man 20ft red custom embroidered with \\u201cGRAND OPENING\\u201d down the center in white lettering. This same message is embroidered on the second side as well. This Air Dancers inflatable tube man is compatible with all 18\\u201d diameter Velcro mount blowers (Blower not included). Spend the extra money to let your customers know what you are promoting.\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Shipping Weight\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 320,\n        \"samples\": [\n          \"2.24 ounces\",\n          \"3.04 pounds\",\n          \"2.5 pounds\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Variants\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 349,\n        \"samples\": [\n          \"https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B07CRV8TGR|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B07CRV975B|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B07CRV5M42|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B01G8UOFAQ|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B00JKQ1AZO|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B07CSWH9WD|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B00C2WZPL8|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B07CRYQFW9\",\n          \"https://www.amazon.com/Poolmaster-Vinyl-Water-Hammock-Blue/dp/B00TQGNJ16|https://www.amazon.com/Poolmaster-Vinyl-Water-Hammock-Blue/dp/B00TQGNJ0W|https://www.amazon.com/Poolmaster-Vinyl-Water-Hammock-Blue/dp/B00TQGNJ66\",\n          \"https://www.amazon.com/Forum-Womens-Flirting-Crinoline-Standard/dp/B012DYPJHO|https://www.amazon.com/Forum-Womens-Flirting-Crinoline-Standard/dp/B013RJ12X4|https://www.amazon.com/Forum-Womens-Flirting-Crinoline-Standard/dp/B00VJ3JDE6\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Product Url\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1345,\n        \"samples\": [\n          \"https://www.amazon.com/Northwest-Company-Phineas-Character-50-inches/dp/B075RGH8CB\",\n          \"https://www.amazon.com/All-About-Details-Birthday-Glitter/dp/B07DP9JRDH\",\n          \"https://www.amazon.com/LEGO-Marvel-Super-Heroes-Avengers/dp/B078W7C8YJ\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Is Amazon Seller\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 2,\n        \"samples\": [\n          \"N\",\n          \"Y\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"description\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1345,\n        \"samples\": [\n          \"Snuggle up with Phineas and Ferb! This super-soft 40x50 inch fleece throw blanket features your favorite Action Agent duo. Perfect for kids' bedrooms, couches, or travel, this Disney blanket offers cozy comfort and vibrant colors.  Machine washable for easy care.\",\n          \"Celebrate their 60th birthday in style! This elegant \\\"Hello 60\\\" cake topper adds a touch of sparkle and sophistication to any 60th birthday cake.  Featuring a glamorous gold and black glitter design (6\\\" x 9\\\"), it's the perfect finishing touch for your party.  Shop now!\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"product_semantics\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1345,\n        \"samples\": [\n          \"The Northwest Company Disney Phineas & Ferb Action Agent Character Fleece Throw Blanket, 40 x 50-inches Home & Kitchen | Bedding | Kids' Bedding | Blankets & Throws | Throws Make sure this fits by entering your model number. | 100% Polyester | Imported | Soft fleece blanket measures 40-inches by 50-inches | Decorated with vibrant graphics | Stay warm and cozy all year long | Machine washable and dryer safe | Made in China Go to your orders and start the return Select the ship method Ship it! | Go to your orders and start the return Select the ship method Ship it! Snuggle up with Phineas and Ferb! This super-soft 40x50 inch fleece throw blanket features your favorite Action Agent duo. Perfect for kids' bedrooms, couches, or travel, this Disney blanket offers cozy comfort and vibrant colors.  Machine washable for easy care.\",\n          \"All About Details CATHE60 Hello 60 Cake, 1pc, 60th Birthday, Party Decor, Glitter Topper (Gold & Black), 6 x 9, Grocery & Gourmet Food | Pantry Staples | Cooking & Baking | Frosting, Icing & Decorations | Cake Toppers Make sure this fits by entering your model number. | Ideal for 6 to 8-in cake to celebrate 60th birthday or 60th anniversary; Use it as cake topper, sign or even photo props | Handcrafted; Made up of multiple layers of quality card stocks; Glitter on the front & complimenting shimmer/matte on the back | The topper measures 6in wide and 5in tall with 2-pcs of 4in wood skewers | Ensure appropriate distance from candles when setting in cake | Visit \\u201cAll About Details\\u201d storefront to check on the other colors and complimenting products available Color:Gold & Black All About Details Hello 60! Cake Topper is ideal for 60th birthday or 60th anniversary. Use it as cake topper, sign or even photo props -Handcrafted -Made up of multiple layers of quality cardstocks -Simple, elegant and versatile | 3.2 ounces (View shipping rates and policies) Celebrate their 60th birthday in style! This elegant \\\"Hello 60\\\" cake topper adds a touch of sparkle and sophistication to any 60th birthday cake.  Featuring a glamorous gold and black glitter design (6\\\" x 9\\\"), it's the perfect finishing touch for your party.  Shop now!\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}",
              "type": "dataframe",
              "variable_name": "product_dataframe"
            },
            "text/html": [
              "\n",
              "  <div id=\"df-3dcd81e2-d7d5-425e-b24a-d859261589c7\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>image</th>\n",
              "      <th>Uniq Id</th>\n",
              "      <th>Product Name</th>\n",
              "      <th>Category</th>\n",
              "      <th>Selling Price</th>\n",
              "      <th>Model Number</th>\n",
              "      <th>About Product</th>\n",
              "      <th>Product Specification</th>\n",
              "      <th>Technical Details</th>\n",
              "      <th>Shipping Weight</th>\n",
              "      <th>Variants</th>\n",
              "      <th>Product Url</th>\n",
              "      <th>Is Amazon Seller</th>\n",
              "      <th>description</th>\n",
              "      <th>product_semantics</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>&lt;PIL.JpegImagePlugin.JpegImageFile image mode=...</td>\n",
              "      <td>002e4642d3ead5ecdc9958ce0b3a5a79</td>\n",
              "      <td>Kurio Glow Smartwatch for Kids with Bluetooth,...</td>\n",
              "      <td>Toys &amp; Games | Kids' Electronics | Electronic ...</td>\n",
              "      <td>$31.30</td>\n",
              "      <td>C17515</td>\n",
              "      <td>Make sure this fits by entering your model num...</td>\n",
              "      <td>ProductDimensions:5x3x12inches|ItemWeight:7.2o...</td>\n",
              "      <td>Color:Blue show up to 2 reviews by default Thi...</td>\n",
              "      <td>7.2 ounces</td>\n",
              "      <td>https://www.amazon.com/Kurio-Smartwatch-Blueto...</td>\n",
              "      <td>https://www.amazon.com/Kurio-Smartwatch-Blueto...</td>\n",
              "      <td>Y</td>\n",
              "      <td>Kurio Glow Smartwatch: Fun, Safe &amp; Educational...</td>\n",
              "      <td>Kurio Glow Smartwatch for Kids with Bluetooth,...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>&lt;PIL.JpegImagePlugin.JpegImageFile image mode=...</td>\n",
              "      <td>009359198555dde1543d94568183703c</td>\n",
              "      <td>Star Ace Toys Harry Potter &amp; The Prisoner of A...</td>\n",
              "      <td>None</td>\n",
              "      <td>$174.99</td>\n",
              "      <td>SA8011B</td>\n",
              "      <td>Make sure this fits by entering your model num...</td>\n",
              "      <td>ProductDimensions:2.5x1x9inches|ItemWeight:1.4...</td>\n",
              "      <td>From Star Ace Toys. Many fans would say that H...</td>\n",
              "      <td>1.43 pounds</td>\n",
              "      <td>None</td>\n",
              "      <td>https://www.amazon.com/Star-Ace-Toys-Prisoner-...</td>\n",
              "      <td>Y</td>\n",
              "      <td>Relive the magic!  Star Ace Toys' 1/8 scale Ha...</td>\n",
              "      <td>Star Ace Toys Harry Potter &amp; The Prisoner of A...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>&lt;PIL.JpegImagePlugin.JpegImageFile image mode=...</td>\n",
              "      <td>00cb3b80482712567c2180767ec28a6a</td>\n",
              "      <td>Barbie Fashionistas Doll Wear Your Heart</td>\n",
              "      <td>Toys &amp; Games | Dolls &amp; Accessories | Dolls</td>\n",
              "      <td>$15.99</td>\n",
              "      <td>FJF44</td>\n",
              "      <td>Make sure this fits by entering your model num...</td>\n",
              "      <td>ProductDimensions:2.1x4.5x12.8inches|ItemWeigh...</td>\n",
              "      <td>Go to your orders and start the return Select ...</td>\n",
              "      <td>4.2 ounces</td>\n",
              "      <td>None</td>\n",
              "      <td>https://www.amazon.com/Barbie-FJF44-Love-Fashi...</td>\n",
              "      <td>Y</td>\n",
              "      <td>Express your style with Barbie Fashionistas Do...</td>\n",
              "      <td>Barbie Fashionistas Doll Wear Your Heart Toys ...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>&lt;PIL.JpegImagePlugin.JpegImageFile image mode=...</td>\n",
              "      <td>00cce525ebf9181ebfba30dc5ca936fd</td>\n",
              "      <td>Redcat Racing Aluminum Rear Lower Suspension A...</td>\n",
              "      <td>Toys &amp; Games | Hobbies | Remote &amp; App Controll...</td>\n",
              "      <td>$14.40</td>\n",
              "      <td>06049B</td>\n",
              "      <td>Aluminum Rear Lower Suspension Arms, Blue (2pc...</td>\n",
              "      <td>ProductDimensions:1.5x3.5x0.2inches|ItemWeight...</td>\n",
              "      <td>2.4 ounces (View shipping rates and policies) ...</td>\n",
              "      <td>2.4 ounces</td>\n",
              "      <td>None</td>\n",
              "      <td>https://www.amazon.com/Redcat-Racing-Aluminum-...</td>\n",
              "      <td>Y</td>\n",
              "      <td>Upgrade your Redcat Racing vehicle's performan...</td>\n",
              "      <td>Redcat Racing Aluminum Rear Lower Suspension A...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>&lt;PIL.JpegImagePlugin.JpegImageFile image mode=...</td>\n",
              "      <td>015cc42a8e93b15bcea9425d63ecbbd9</td>\n",
              "      <td>Tru-Ray Heavyweight Construction Paper Pad, 10...</td>\n",
              "      <td>Arts, Crafts &amp; Sewing | Crafting | Paper &amp; Pap...</td>\n",
              "      <td>$10.10</td>\n",
              "      <td>6592</td>\n",
              "      <td>Make sure this fits by entering your model num...</td>\n",
              "      <td>ASIN:B01ELJGWKW|ShippingWeight:1pounds(Viewshi...</td>\n",
              "      <td>Go to your orders and start the return Select ...</td>\n",
              "      <td>1 pounds</td>\n",
              "      <td>https://www.amazon.com/Tru-Ray-Heavyweight-Con...</td>\n",
              "      <td>https://www.amazon.com/Tru-Ray-Heavyweight-Con...</td>\n",
              "      <td>Y</td>\n",
              "      <td>Unleash your creativity with Tru-Ray Heavyweig...</td>\n",
              "      <td>Tru-Ray Heavyweight Construction Paper Pad, 10...</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-3dcd81e2-d7d5-425e-b24a-d859261589c7')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-3dcd81e2-d7d5-425e-b24a-d859261589c7 button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-3dcd81e2-d7d5-425e-b24a-d859261589c7');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "<div id=\"df-0fe312f1-a920-4b65-afef-3f1d7e00fbd3\">\n",
              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-0fe312f1-a920-4b65-afef-3f1d7e00fbd3')\"\n",
              "            title=\"Suggest charts\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "  </button>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "      --bg-color: #E8F0FE;\n",
              "      --fill-color: #1967D2;\n",
              "      --hover-bg-color: #E2EBFA;\n",
              "      --hover-fill-color: #174EA6;\n",
              "      --disabled-fill-color: #AAA;\n",
              "      --disabled-bg-color: #DDD;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "      --bg-color: #3B4455;\n",
              "      --fill-color: #D2E3FC;\n",
              "      --hover-bg-color: #434B5C;\n",
              "      --hover-fill-color: #FFFFFF;\n",
              "      --disabled-bg-color: #3B4455;\n",
              "      --disabled-fill-color: #666;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart {\n",
              "    background-color: var(--bg-color);\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: var(--fill-color);\n",
              "    height: 32px;\n",
              "    padding: 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: var(--hover-bg-color);\n",
              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: var(--button-hover-fill-color);\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart-complete:disabled,\n",
              "  .colab-df-quickchart-complete:disabled:hover {\n",
              "    background-color: var(--disabled-bg-color);\n",
              "    fill: var(--disabled-fill-color);\n",
              "    box-shadow: none;\n",
              "  }\n",
              "\n",
              "  .colab-df-spinner {\n",
              "    border: 2px solid var(--fill-color);\n",
              "    border-color: transparent;\n",
              "    border-bottom-color: var(--fill-color);\n",
              "    animation:\n",
              "      spin 1s steps(1) infinite;\n",
              "  }\n",
              "\n",
              "  @keyframes spin {\n",
              "    0% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "      border-left-color: var(--fill-color);\n",
              "    }\n",
              "    20% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    30% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    40% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    60% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    80% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "    90% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "  }\n",
              "</style>\n",
              "\n",
              "  <script>\n",
              "    async function quickchart(key) {\n",
              "      const quickchartButtonEl =\n",
              "        document.querySelector('#' + key + ' button');\n",
              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
              "      try {\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      } catch (error) {\n",
              "        console.error('Error during call to suggestCharts:', error);\n",
              "      }\n",
              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
              "    }\n",
              "    (() => {\n",
              "      let quickchartButtonEl =\n",
              "        document.querySelector('#df-0fe312f1-a920-4b65-afef-3f1d7e00fbd3 button');\n",
              "      quickchartButtonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "    })();\n",
              "  </script>\n",
              "</div>\n",
              "\n",
              "    </div>\n",
              "  </div>\n"
            ],
            "text/plain": [
              "                                               image  \\\n",
              "0  <PIL.JpegImagePlugin.JpegImageFile image mode=...   \n",
              "1  <PIL.JpegImagePlugin.JpegImageFile image mode=...   \n",
              "2  <PIL.JpegImagePlugin.JpegImageFile image mode=...   \n",
              "3  <PIL.JpegImagePlugin.JpegImageFile image mode=...   \n",
              "4  <PIL.JpegImagePlugin.JpegImageFile image mode=...   \n",
              "\n",
              "                            Uniq Id  \\\n",
              "0  002e4642d3ead5ecdc9958ce0b3a5a79   \n",
              "1  009359198555dde1543d94568183703c   \n",
              "2  00cb3b80482712567c2180767ec28a6a   \n",
              "3  00cce525ebf9181ebfba30dc5ca936fd   \n",
              "4  015cc42a8e93b15bcea9425d63ecbbd9   \n",
              "\n",
              "                                        Product Name  \\\n",
              "0  Kurio Glow Smartwatch for Kids with Bluetooth,...   \n",
              "1  Star Ace Toys Harry Potter & The Prisoner of A...   \n",
              "2           Barbie Fashionistas Doll Wear Your Heart   \n",
              "3  Redcat Racing Aluminum Rear Lower Suspension A...   \n",
              "4  Tru-Ray Heavyweight Construction Paper Pad, 10...   \n",
              "\n",
              "                                            Category Selling Price  \\\n",
              "0  Toys & Games | Kids' Electronics | Electronic ...        $31.30   \n",
              "1                                               None       $174.99   \n",
              "2         Toys & Games | Dolls & Accessories | Dolls        $15.99   \n",
              "3  Toys & Games | Hobbies | Remote & App Controll...        $14.40   \n",
              "4  Arts, Crafts & Sewing | Crafting | Paper & Pap...        $10.10   \n",
              "\n",
              "  Model Number                                      About Product  \\\n",
              "0       C17515  Make sure this fits by entering your model num...   \n",
              "1      SA8011B  Make sure this fits by entering your model num...   \n",
              "2        FJF44  Make sure this fits by entering your model num...   \n",
              "3       06049B  Aluminum Rear Lower Suspension Arms, Blue (2pc...   \n",
              "4         6592  Make sure this fits by entering your model num...   \n",
              "\n",
              "                               Product Specification  \\\n",
              "0  ProductDimensions:5x3x12inches|ItemWeight:7.2o...   \n",
              "1  ProductDimensions:2.5x1x9inches|ItemWeight:1.4...   \n",
              "2  ProductDimensions:2.1x4.5x12.8inches|ItemWeigh...   \n",
              "3  ProductDimensions:1.5x3.5x0.2inches|ItemWeight...   \n",
              "4  ASIN:B01ELJGWKW|ShippingWeight:1pounds(Viewshi...   \n",
              "\n",
              "                                   Technical Details Shipping Weight  \\\n",
              "0  Color:Blue show up to 2 reviews by default Thi...      7.2 ounces   \n",
              "1  From Star Ace Toys. Many fans would say that H...     1.43 pounds   \n",
              "2  Go to your orders and start the return Select ...      4.2 ounces   \n",
              "3  2.4 ounces (View shipping rates and policies) ...      2.4 ounces   \n",
              "4  Go to your orders and start the return Select ...        1 pounds   \n",
              "\n",
              "                                            Variants  \\\n",
              "0  https://www.amazon.com/Kurio-Smartwatch-Blueto...   \n",
              "1                                               None   \n",
              "2                                               None   \n",
              "3                                               None   \n",
              "4  https://www.amazon.com/Tru-Ray-Heavyweight-Con...   \n",
              "\n",
              "                                         Product Url Is Amazon Seller  \\\n",
              "0  https://www.amazon.com/Kurio-Smartwatch-Blueto...                Y   \n",
              "1  https://www.amazon.com/Star-Ace-Toys-Prisoner-...                Y   \n",
              "2  https://www.amazon.com/Barbie-FJF44-Love-Fashi...                Y   \n",
              "3  https://www.amazon.com/Redcat-Racing-Aluminum-...                Y   \n",
              "4  https://www.amazon.com/Tru-Ray-Heavyweight-Con...                Y   \n",
              "\n",
              "                                         description  \\\n",
              "0  Kurio Glow Smartwatch: Fun, Safe & Educational...   \n",
              "1  Relive the magic!  Star Ace Toys' 1/8 scale Ha...   \n",
              "2  Express your style with Barbie Fashionistas Do...   \n",
              "3  Upgrade your Redcat Racing vehicle's performan...   \n",
              "4  Unleash your creativity with Tru-Ray Heavyweig...   \n",
              "\n",
              "                                   product_semantics  \n",
              "0  Kurio Glow Smartwatch for Kids with Bluetooth,...  \n",
              "1  Star Ace Toys Harry Potter & The Prisoner of A...  \n",
              "2  Barbie Fashionistas Doll Wear Your Heart Toys ...  \n",
              "3  Redcat Racing Aluminum Rear Lower Suspension A...  \n",
              "4  Tru-Ray Heavyweight Construction Paper Pad, 10...  "
            ]
          },
          "execution_count": 6,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "# Display top 5 data point to see new coloumn\n",
        "product_dataframe.head()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 7,
      "metadata": {
        "id": "9HbHHxgHKuMG"
      },
      "outputs": [],
      "source": [
        "# We are not using the image data, so let's remove this\n",
        "product_dataframe = product_dataframe.drop(columns=[\"image\"])"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "FybwENh6Lzzj"
      },
      "source": [
        "## Step 3: Embedding Generation With Cohere"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "cZh2UjzepS5U"
      },
      "source": [
        "To facilitate semantic search capabilities, each product document is enriched with embeddings. The `get_embedding()` function utilizes the Cohere API to generate a numerical representation of each product's semantic meaning. This function leverages the `embed-english-v3.0` model from Cohere to embed the combined textual information stored in each document's `product_semantics` field.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 8,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "8j0Q3AKEMPFG",
        "outputId": "e772d2ef-7613-479b-ec05-2e200786fd11"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Enter your Cohere API Key: ··········\n"
          ]
        }
      ],
      "source": [
        "# Add Cohere API Key to Environment Variable\n",
        "set_env_securely(\"COHERE_API_KEY\", \"Enter your Cohere API Key: \")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 9,
      "metadata": {
        "id": "e5WuXzVLLzEj"
      },
      "outputs": [],
      "source": [
        "import cohere\n",
        "\n",
        "co = cohere.ClientV2()\n",
        "\n",
        "\n",
        "def get_embedding(texts, model=\"embed-english-v3.0\", input_type=\"search_document\"):\n",
        "    \"\"\"Gets embeddings for a list of texts using the Cohere API.\n",
        "\n",
        "    Args:\n",
        "      texts: A list of texts to embed.\n",
        "      model: The Cohere embedding model to use.\n",
        "      input_type: The input type for the embedding model.\n",
        "\n",
        "    Returns:\n",
        "      A list of embeddings, where each embedding is a list of floats.\n",
        "    \"\"\"\n",
        "    try:\n",
        "        response = co.embed(\n",
        "            texts=[texts],\n",
        "            model=model,\n",
        "            input_type=input_type,\n",
        "            embedding_types=[\"float\"],\n",
        "        )\n",
        "        # Extract and return the embeddings\n",
        "        return response.embeddings.float[0]\n",
        "    except Exception as e:\n",
        "        print(f\"Error generating embeddings: {e}\")\n",
        "        print(\"Couldn't generate emebedding for text: \")\n",
        "        print(texts)\n",
        "        return None"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 10,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "dgLhZJbPMXrr",
        "outputId": "0c26175a-9971-4199-e904-7adaf06addbe"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Embeddings generated successfully\n"
          ]
        }
      ],
      "source": [
        "# Generate an embedding coloum for each datapoint in the dataset\n",
        "# Embedding is generated from the new product semantics attribute\n",
        "try:\n",
        "    product_dataframe[\"embedding\"] = product_dataframe[\"product_semantics\"].apply(\n",
        "        get_embedding\n",
        "    )\n",
        "    print(\"Embeddings generated successfully\")\n",
        "except Exception as e:\n",
        "    print(f\"Error generating embeddings: {e}\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "coKUkeyrpYx_"
      },
      "source": [
        "The resulting embeddings are then stored within a dedicated 'embedding' field in each product document. This step enables the system to search for products based on their semantic similarity, allowing for more nuanced and relevant recommendations.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 11,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 643
        },
        "id": "1fQJr4OZMjx4",
        "outputId": "ec8c53f0-1cc0-424d-d41e-8d9c2abe3ee8"
      },
      "outputs": [
        {
          "data": {
            "application/vnd.google.colaboratory.intrinsic+json": {
              "summary": "{\n  \"name\": \"product_dataframe\",\n  \"rows\": 1345,\n  \"fields\": [\n    {\n      \"column\": \"Uniq Id\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1345,\n        \"samples\": [\n          \"3729b400bb500a9b2259312fdbd1e04f\",\n          \"3123f9557a14299160bde77c2e1900be\",\n          \"ea3ee7f352156915cba99e61ccd5910f\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Product Name\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1345,\n        \"samples\": [\n          \"The Northwest Company Disney Phineas & Ferb Action Agent Character Fleece Throw Blanket, 40 x 50-inches\",\n          \"All About Details CATHE60 Hello 60 Cake, 1pc, 60th Birthday, Party Decor, Glitter Topper (Gold & Black), 6 x 9,\",\n          \"LEGO Marvel Super Heroes Avengers: Infinity War The Hulkbuster: Ultron Edition 76105 Building Kit (1363 Pieces)\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Category\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 362,\n        \"samples\": [\n          \"Sports & Outdoors | Outdoor Recreation | Skates, Skateboards & Scooters | Skateboarding | Protective Gear | Elbow Pads\",\n          \"Toys & Games | Stuffed Animals & Plush Toys\",\n          \"Clothing, Shoes & Jewelry | Costumes & Accessories | Women | Costumes & Cosplay Apparel | Costumes\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Selling Price\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 875,\n        \"samples\": [\n          \"$29.99 - $35.95\",\n          \"$13.62\",\n          \"$21.95\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Model Number\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1123,\n        \"samples\": [\n          \"12-HY2764\",\n          \"CX21823A6BW\",\n          \"-\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"About Product\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1277,\n        \"samples\": [\n          \"100% Polyester | Imported | Hand Wash | Black baseball hat looks like brains are spilling out the top | Wear to top off your zombie and ghoul costume or on its own just for fun | Not just for halloween, wear this slightly scary cap year-around | One size fits teens and adults | Rubies costume has been a world leader in dress-up fun for all ages since 1950\",\n          \"1:72nd Scale WWII Military Aircraft Plastic Model Kit | Livery A: #54 Operational Training Unit, RAF Church Fenton, North Yorkshire, England Dec 1940 Livery B: #600 City of London Squadron, Royal Auxiliary Air Force Manston, Kent, England Aug 1940 | Skill Level: 3 Number of Parts: 156 | Humbrol Paints needed are listed on the outside of the box. | Construction and painting required: yes, glue and paints need to be purchased separately\",\n          \"Make sure this fits by entering your model number. | Easily washes off skin and most fabrics | AP certified non-toxic - Safe for use around all ages | Perfect for schools, day cares, preschools and more | Bright colors are sure to please artists young and old | Easy to pour 16-Ounce bottle\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Product Specification\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1154,\n        \"samples\": [\n          \"ProductDimensions:1.2x13x9.2inches|ItemWeight:9.6ounces|ShippingWeight:9.6ounces(Viewshippingratesandpolicies)|ASIN:B07SR2MS7W|Itemmodelnumber:820650804045|Manufacturerrecommendedage:6yearsandup\",\n          \"ProductDimensions:4.5x9x5.5inches|ItemWeight:5.9ounces|ShippingWeight:5.9ounces(Viewshippingratesandpolicies)|DomesticShipping:ItemcanbeshippedwithinU.S.|InternationalShipping:ThisitemcanbeshippedtoselectcountriesoutsideoftheU.S.LearnMore|ASIN:B0749V8K58|Itemmodelnumber:02496|Manufacturerrecommendedage:3yearsandup\",\n          \"ProductDimensions:6.5x4.1x4.1inches|ItemWeight:2.35pounds|ShippingWeight:2.35pounds(Viewshippingratesandpolicies)|DomesticShipping:ItemcanbeshippedwithinU.S.|InternationalShipping:ThisitemcanbeshippedtoselectcountriesoutsideoftheU.S.LearnMore|ASIN:B00KJB1KSQ|Itemmodelnumber:DTXC3588|Manufacturerrecommendedage:15yearsandup\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Technical Details\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1191,\n        \"samples\": [\n          \"Package Quantity:1 show up to 2 reviews by default Amscan.inc is the largest designer, manufacturer, and distributor of decorated party goods and party accessories in the world, founded in 1947. Our company is also a leading supplier of gifts, home decor, and tabletop products as well as the primary source for gift wrap, gift bags, stationery, and licensed products. Our party offering is comprised of more than 300 innovative party ensembles including tableware, accessories, balloons, novelties, stationery, gift wrap, and decorations. Gifts that inspire and satisfy customer needs. Decorate your party tables with this Fiesta Mini Centerpiece Assortment. These mini centerpieces unfold easily and can be set up on any flat surface. The centerpieces are 5\\\" tall and are very colorful. The centerpieces feature maracas, peppers and a cactus with a sombrero. Perfect for Cinco de Mayo or any Mexican-themed bash. Amscan pledge to provide you the quality product at a reasonable price. If you come in, we will give you the reason to come back. Premium quality, Affordable, Value pack, Easy to use, Best for any party | 1.6 ounces (View shipping rates and policies)\",\n          \"Go to your orders and start the return Select the ship method Ship it! | Go to your orders and start the return Select the ship method Ship it! | The best-selling, interactive Hot Dots Talking Pen has a brand new look! Press the sleek, silver Pen to an answer dot on any Hot Dots or Hot Dots Jr. question for instantaneous visual and audio feedback! With 17 speech and sound effects and fun, flashing lights, the Hot Dots Talking Pen is perfect for independent, self-paced learning, guiding kids through dozens of interactive books, activities, and card sets. The Hot Dots Talking Pen is compatible with all Hot Dots and Hot Dots Jr. sets and requires 2 AAA batteries. | 2.4 ounces (View shipping rates and policies)\",\n          \"Air Dancers inflatable tube man 20ft red custom embroidered with \\u201cGRAND OPENING\\u201d down the center in white lettering. This same message is embroidered on the second side as well. This Air Dancers inflatable tube man is compatible with all 18\\u201d diameter Velcro mount blowers (Blower not included). Spend the extra money to let your customers know what you are promoting.\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Shipping Weight\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 320,\n        \"samples\": [\n          \"2.24 ounces\",\n          \"3.04 pounds\",\n          \"2.5 pounds\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Variants\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 349,\n        \"samples\": [\n          \"https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B07CRV8TGR|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B07CRV975B|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B07CRV5M42|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B01G8UOFAQ|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B00JKQ1AZO|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B07CSWH9WD|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B00C2WZPL8|https://www.amazon.com/Disneys-Mickey-Classic-Raschel-Blanket/dp/B07CRYQFW9\",\n          \"https://www.amazon.com/Poolmaster-Vinyl-Water-Hammock-Blue/dp/B00TQGNJ16|https://www.amazon.com/Poolmaster-Vinyl-Water-Hammock-Blue/dp/B00TQGNJ0W|https://www.amazon.com/Poolmaster-Vinyl-Water-Hammock-Blue/dp/B00TQGNJ66\",\n          \"https://www.amazon.com/Forum-Womens-Flirting-Crinoline-Standard/dp/B012DYPJHO|https://www.amazon.com/Forum-Womens-Flirting-Crinoline-Standard/dp/B013RJ12X4|https://www.amazon.com/Forum-Womens-Flirting-Crinoline-Standard/dp/B00VJ3JDE6\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Product Url\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1345,\n        \"samples\": [\n          \"https://www.amazon.com/Northwest-Company-Phineas-Character-50-inches/dp/B075RGH8CB\",\n          \"https://www.amazon.com/All-About-Details-Birthday-Glitter/dp/B07DP9JRDH\",\n          \"https://www.amazon.com/LEGO-Marvel-Super-Heroes-Avengers/dp/B078W7C8YJ\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"Is Amazon Seller\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 2,\n        \"samples\": [\n          \"N\",\n          \"Y\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"description\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1345,\n        \"samples\": [\n          \"Snuggle up with Phineas and Ferb! This super-soft 40x50 inch fleece throw blanket features your favorite Action Agent duo. Perfect for kids' bedrooms, couches, or travel, this Disney blanket offers cozy comfort and vibrant colors.  Machine washable for easy care.\",\n          \"Celebrate their 60th birthday in style! This elegant \\\"Hello 60\\\" cake topper adds a touch of sparkle and sophistication to any 60th birthday cake.  Featuring a glamorous gold and black glitter design (6\\\" x 9\\\"), it's the perfect finishing touch for your party.  Shop now!\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"product_semantics\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 1345,\n        \"samples\": [\n          \"The Northwest Company Disney Phineas & Ferb Action Agent Character Fleece Throw Blanket, 40 x 50-inches Home & Kitchen | Bedding | Kids' Bedding | Blankets & Throws | Throws Make sure this fits by entering your model number. | 100% Polyester | Imported | Soft fleece blanket measures 40-inches by 50-inches | Decorated with vibrant graphics | Stay warm and cozy all year long | Machine washable and dryer safe | Made in China Go to your orders and start the return Select the ship method Ship it! | Go to your orders and start the return Select the ship method Ship it! Snuggle up with Phineas and Ferb! This super-soft 40x50 inch fleece throw blanket features your favorite Action Agent duo. Perfect for kids' bedrooms, couches, or travel, this Disney blanket offers cozy comfort and vibrant colors.  Machine washable for easy care.\",\n          \"All About Details CATHE60 Hello 60 Cake, 1pc, 60th Birthday, Party Decor, Glitter Topper (Gold & Black), 6 x 9, Grocery & Gourmet Food | Pantry Staples | Cooking & Baking | Frosting, Icing & Decorations | Cake Toppers Make sure this fits by entering your model number. | Ideal for 6 to 8-in cake to celebrate 60th birthday or 60th anniversary; Use it as cake topper, sign or even photo props | Handcrafted; Made up of multiple layers of quality card stocks; Glitter on the front & complimenting shimmer/matte on the back | The topper measures 6in wide and 5in tall with 2-pcs of 4in wood skewers | Ensure appropriate distance from candles when setting in cake | Visit \\u201cAll About Details\\u201d storefront to check on the other colors and complimenting products available Color:Gold & Black All About Details Hello 60! Cake Topper is ideal for 60th birthday or 60th anniversary. Use it as cake topper, sign or even photo props -Handcrafted -Made up of multiple layers of quality cardstocks -Simple, elegant and versatile | 3.2 ounces (View shipping rates and policies) Celebrate their 60th birthday in style! This elegant \\\"Hello 60\\\" cake topper adds a touch of sparkle and sophistication to any 60th birthday cake.  Featuring a glamorous gold and black glitter design (6\\\" x 9\\\"), it's the perfect finishing touch for your party.  Shop now!\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"embedding\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}",
              "type": "dataframe",
              "variable_name": "product_dataframe"
            },
            "text/html": [
              "\n",
              "  <div id=\"df-9f84471e-045a-4fc0-8277-9830c2445b35\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>Uniq Id</th>\n",
              "      <th>Product Name</th>\n",
              "      <th>Category</th>\n",
              "      <th>Selling Price</th>\n",
              "      <th>Model Number</th>\n",
              "      <th>About Product</th>\n",
              "      <th>Product Specification</th>\n",
              "      <th>Technical Details</th>\n",
              "      <th>Shipping Weight</th>\n",
              "      <th>Variants</th>\n",
              "      <th>Product Url</th>\n",
              "      <th>Is Amazon Seller</th>\n",
              "      <th>description</th>\n",
              "      <th>product_semantics</th>\n",
              "      <th>embedding</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>002e4642d3ead5ecdc9958ce0b3a5a79</td>\n",
              "      <td>Kurio Glow Smartwatch for Kids with Bluetooth,...</td>\n",
              "      <td>Toys &amp; Games | Kids' Electronics | Electronic ...</td>\n",
              "      <td>$31.30</td>\n",
              "      <td>C17515</td>\n",
              "      <td>Make sure this fits by entering your model num...</td>\n",
              "      <td>ProductDimensions:5x3x12inches|ItemWeight:7.2o...</td>\n",
              "      <td>Color:Blue show up to 2 reviews by default Thi...</td>\n",
              "      <td>7.2 ounces</td>\n",
              "      <td>https://www.amazon.com/Kurio-Smartwatch-Blueto...</td>\n",
              "      <td>https://www.amazon.com/Kurio-Smartwatch-Blueto...</td>\n",
              "      <td>Y</td>\n",
              "      <td>Kurio Glow Smartwatch: Fun, Safe &amp; Educational...</td>\n",
              "      <td>Kurio Glow Smartwatch for Kids with Bluetooth,...</td>\n",
              "      <td>[-0.055847168, -0.038269043, 0.02154541, 0.007...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>009359198555dde1543d94568183703c</td>\n",
              "      <td>Star Ace Toys Harry Potter &amp; The Prisoner of A...</td>\n",
              "      <td>None</td>\n",
              "      <td>$174.99</td>\n",
              "      <td>SA8011B</td>\n",
              "      <td>Make sure this fits by entering your model num...</td>\n",
              "      <td>ProductDimensions:2.5x1x9inches|ItemWeight:1.4...</td>\n",
              "      <td>From Star Ace Toys. Many fans would say that H...</td>\n",
              "      <td>1.43 pounds</td>\n",
              "      <td>None</td>\n",
              "      <td>https://www.amazon.com/Star-Ace-Toys-Prisoner-...</td>\n",
              "      <td>Y</td>\n",
              "      <td>Relive the magic!  Star Ace Toys' 1/8 scale Ha...</td>\n",
              "      <td>Star Ace Toys Harry Potter &amp; The Prisoner of A...</td>\n",
              "      <td>[0.0033798218, 0.028213501, -0.028823853, -0.0...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>00cb3b80482712567c2180767ec28a6a</td>\n",
              "      <td>Barbie Fashionistas Doll Wear Your Heart</td>\n",
              "      <td>Toys &amp; Games | Dolls &amp; Accessories | Dolls</td>\n",
              "      <td>$15.99</td>\n",
              "      <td>FJF44</td>\n",
              "      <td>Make sure this fits by entering your model num...</td>\n",
              "      <td>ProductDimensions:2.1x4.5x12.8inches|ItemWeigh...</td>\n",
              "      <td>Go to your orders and start the return Select ...</td>\n",
              "      <td>4.2 ounces</td>\n",
              "      <td>None</td>\n",
              "      <td>https://www.amazon.com/Barbie-FJF44-Love-Fashi...</td>\n",
              "      <td>Y</td>\n",
              "      <td>Express your style with Barbie Fashionistas Do...</td>\n",
              "      <td>Barbie Fashionistas Doll Wear Your Heart Toys ...</td>\n",
              "      <td>[-0.027145386, -0.025802612, 0.013519287, 0.03...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>00cce525ebf9181ebfba30dc5ca936fd</td>\n",
              "      <td>Redcat Racing Aluminum Rear Lower Suspension A...</td>\n",
              "      <td>Toys &amp; Games | Hobbies | Remote &amp; App Controll...</td>\n",
              "      <td>$14.40</td>\n",
              "      <td>06049B</td>\n",
              "      <td>Aluminum Rear Lower Suspension Arms, Blue (2pc...</td>\n",
              "      <td>ProductDimensions:1.5x3.5x0.2inches|ItemWeight...</td>\n",
              "      <td>2.4 ounces (View shipping rates and policies) ...</td>\n",
              "      <td>2.4 ounces</td>\n",
              "      <td>None</td>\n",
              "      <td>https://www.amazon.com/Redcat-Racing-Aluminum-...</td>\n",
              "      <td>Y</td>\n",
              "      <td>Upgrade your Redcat Racing vehicle's performan...</td>\n",
              "      <td>Redcat Racing Aluminum Rear Lower Suspension A...</td>\n",
              "      <td>[-0.033172607, -0.040802002, 0.00080776215, -0...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>015cc42a8e93b15bcea9425d63ecbbd9</td>\n",
              "      <td>Tru-Ray Heavyweight Construction Paper Pad, 10...</td>\n",
              "      <td>Arts, Crafts &amp; Sewing | Crafting | Paper &amp; Pap...</td>\n",
              "      <td>$10.10</td>\n",
              "      <td>6592</td>\n",
              "      <td>Make sure this fits by entering your model num...</td>\n",
              "      <td>ASIN:B01ELJGWKW|ShippingWeight:1pounds(Viewshi...</td>\n",
              "      <td>Go to your orders and start the return Select ...</td>\n",
              "      <td>1 pounds</td>\n",
              "      <td>https://www.amazon.com/Tru-Ray-Heavyweight-Con...</td>\n",
              "      <td>https://www.amazon.com/Tru-Ray-Heavyweight-Con...</td>\n",
              "      <td>Y</td>\n",
              "      <td>Unleash your creativity with Tru-Ray Heavyweig...</td>\n",
              "      <td>Tru-Ray Heavyweight Construction Paper Pad, 10...</td>\n",
              "      <td>[-0.06726074, -0.005001068, -0.076049805, -0.0...</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-9f84471e-045a-4fc0-8277-9830c2445b35')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-9f84471e-045a-4fc0-8277-9830c2445b35 button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-9f84471e-045a-4fc0-8277-9830c2445b35');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "<div id=\"df-d7918f20-bbef-4083-9e3c-d3bd0f0a9e91\">\n",
              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-d7918f20-bbef-4083-9e3c-d3bd0f0a9e91')\"\n",
              "            title=\"Suggest charts\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "  </button>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "      --bg-color: #E8F0FE;\n",
              "      --fill-color: #1967D2;\n",
              "      --hover-bg-color: #E2EBFA;\n",
              "      --hover-fill-color: #174EA6;\n",
              "      --disabled-fill-color: #AAA;\n",
              "      --disabled-bg-color: #DDD;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "      --bg-color: #3B4455;\n",
              "      --fill-color: #D2E3FC;\n",
              "      --hover-bg-color: #434B5C;\n",
              "      --hover-fill-color: #FFFFFF;\n",
              "      --disabled-bg-color: #3B4455;\n",
              "      --disabled-fill-color: #666;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart {\n",
              "    background-color: var(--bg-color);\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: var(--fill-color);\n",
              "    height: 32px;\n",
              "    padding: 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: var(--hover-bg-color);\n",
              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: var(--button-hover-fill-color);\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart-complete:disabled,\n",
              "  .colab-df-quickchart-complete:disabled:hover {\n",
              "    background-color: var(--disabled-bg-color);\n",
              "    fill: var(--disabled-fill-color);\n",
              "    box-shadow: none;\n",
              "  }\n",
              "\n",
              "  .colab-df-spinner {\n",
              "    border: 2px solid var(--fill-color);\n",
              "    border-color: transparent;\n",
              "    border-bottom-color: var(--fill-color);\n",
              "    animation:\n",
              "      spin 1s steps(1) infinite;\n",
              "  }\n",
              "\n",
              "  @keyframes spin {\n",
              "    0% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "      border-left-color: var(--fill-color);\n",
              "    }\n",
              "    20% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    30% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    40% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    60% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    80% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "    90% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "  }\n",
              "</style>\n",
              "\n",
              "  <script>\n",
              "    async function quickchart(key) {\n",
              "      const quickchartButtonEl =\n",
              "        document.querySelector('#' + key + ' button');\n",
              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
              "      try {\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      } catch (error) {\n",
              "        console.error('Error during call to suggestCharts:', error);\n",
              "      }\n",
              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
              "    }\n",
              "    (() => {\n",
              "      let quickchartButtonEl =\n",
              "        document.querySelector('#df-d7918f20-bbef-4083-9e3c-d3bd0f0a9e91 button');\n",
              "      quickchartButtonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "    })();\n",
              "  </script>\n",
              "</div>\n",
              "\n",
              "    </div>\n",
              "  </div>\n"
            ],
            "text/plain": [
              "                            Uniq Id  \\\n",
              "0  002e4642d3ead5ecdc9958ce0b3a5a79   \n",
              "1  009359198555dde1543d94568183703c   \n",
              "2  00cb3b80482712567c2180767ec28a6a   \n",
              "3  00cce525ebf9181ebfba30dc5ca936fd   \n",
              "4  015cc42a8e93b15bcea9425d63ecbbd9   \n",
              "\n",
              "                                        Product Name  \\\n",
              "0  Kurio Glow Smartwatch for Kids with Bluetooth,...   \n",
              "1  Star Ace Toys Harry Potter & The Prisoner of A...   \n",
              "2           Barbie Fashionistas Doll Wear Your Heart   \n",
              "3  Redcat Racing Aluminum Rear Lower Suspension A...   \n",
              "4  Tru-Ray Heavyweight Construction Paper Pad, 10...   \n",
              "\n",
              "                                            Category Selling Price  \\\n",
              "0  Toys & Games | Kids' Electronics | Electronic ...        $31.30   \n",
              "1                                               None       $174.99   \n",
              "2         Toys & Games | Dolls & Accessories | Dolls        $15.99   \n",
              "3  Toys & Games | Hobbies | Remote & App Controll...        $14.40   \n",
              "4  Arts, Crafts & Sewing | Crafting | Paper & Pap...        $10.10   \n",
              "\n",
              "  Model Number                                      About Product  \\\n",
              "0       C17515  Make sure this fits by entering your model num...   \n",
              "1      SA8011B  Make sure this fits by entering your model num...   \n",
              "2        FJF44  Make sure this fits by entering your model num...   \n",
              "3       06049B  Aluminum Rear Lower Suspension Arms, Blue (2pc...   \n",
              "4         6592  Make sure this fits by entering your model num...   \n",
              "\n",
              "                               Product Specification  \\\n",
              "0  ProductDimensions:5x3x12inches|ItemWeight:7.2o...   \n",
              "1  ProductDimensions:2.5x1x9inches|ItemWeight:1.4...   \n",
              "2  ProductDimensions:2.1x4.5x12.8inches|ItemWeigh...   \n",
              "3  ProductDimensions:1.5x3.5x0.2inches|ItemWeight...   \n",
              "4  ASIN:B01ELJGWKW|ShippingWeight:1pounds(Viewshi...   \n",
              "\n",
              "                                   Technical Details Shipping Weight  \\\n",
              "0  Color:Blue show up to 2 reviews by default Thi...      7.2 ounces   \n",
              "1  From Star Ace Toys. Many fans would say that H...     1.43 pounds   \n",
              "2  Go to your orders and start the return Select ...      4.2 ounces   \n",
              "3  2.4 ounces (View shipping rates and policies) ...      2.4 ounces   \n",
              "4  Go to your orders and start the return Select ...        1 pounds   \n",
              "\n",
              "                                            Variants  \\\n",
              "0  https://www.amazon.com/Kurio-Smartwatch-Blueto...   \n",
              "1                                               None   \n",
              "2                                               None   \n",
              "3                                               None   \n",
              "4  https://www.amazon.com/Tru-Ray-Heavyweight-Con...   \n",
              "\n",
              "                                         Product Url Is Amazon Seller  \\\n",
              "0  https://www.amazon.com/Kurio-Smartwatch-Blueto...                Y   \n",
              "1  https://www.amazon.com/Star-Ace-Toys-Prisoner-...                Y   \n",
              "2  https://www.amazon.com/Barbie-FJF44-Love-Fashi...                Y   \n",
              "3  https://www.amazon.com/Redcat-Racing-Aluminum-...                Y   \n",
              "4  https://www.amazon.com/Tru-Ray-Heavyweight-Con...                Y   \n",
              "\n",
              "                                         description  \\\n",
              "0  Kurio Glow Smartwatch: Fun, Safe & Educational...   \n",
              "1  Relive the magic!  Star Ace Toys' 1/8 scale Ha...   \n",
              "2  Express your style with Barbie Fashionistas Do...   \n",
              "3  Upgrade your Redcat Racing vehicle's performan...   \n",
              "4  Unleash your creativity with Tru-Ray Heavyweig...   \n",
              "\n",
              "                                   product_semantics  \\\n",
              "0  Kurio Glow Smartwatch for Kids with Bluetooth,...   \n",
              "1  Star Ace Toys Harry Potter & The Prisoner of A...   \n",
              "2  Barbie Fashionistas Doll Wear Your Heart Toys ...   \n",
              "3  Redcat Racing Aluminum Rear Lower Suspension A...   \n",
              "4  Tru-Ray Heavyweight Construction Paper Pad, 10...   \n",
              "\n",
              "                                           embedding  \n",
              "0  [-0.055847168, -0.038269043, 0.02154541, 0.007...  \n",
              "1  [0.0033798218, 0.028213501, -0.028823853, -0.0...  \n",
              "2  [-0.027145386, -0.025802612, 0.013519287, 0.03...  \n",
              "3  [-0.033172607, -0.040802002, 0.00080776215, -0...  \n",
              "4  [-0.06726074, -0.005001068, -0.076049805, -0.0...  "
            ]
          },
          "execution_count": 11,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "product_dataframe.head()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "RfmRg6jOQ8kb"
      },
      "source": [
        "## Step 4: Data Ingestion To MongoDB\n",
        "\n",
        "MongoDB acts as both an operational and a vector database for the RAG system.\n",
        "MongoDB Atlas specifically provides a database solution that efficiently stores, queries and retrieves vector embeddings.\n",
        "\n",
        "Creating a database and collection within MongoDB is made simple with MongoDB Atlas.\n",
        "\n",
        "1. First, register for a [MongoDB Atlas account](https://www.mongodb.com/cloud/atlas/register). For existing users, sign into MongoDB Atlas.\n",
        "2. [Follow the instructions](https://www.mongodb.com/docs/atlas/tutorial/deploy-free-tier-cluster/). Select Atlas UI as the procedure to deploy your first cluster.\n",
        "\n",
        "Follow MongoDB’s [steps to get the connection](https://www.mongodb.com/docs/manual/reference/connection-string/) string from the Atlas UI. After setting up the database and obtaining the Atlas cluster connection URI, securely store the URI within your development environment."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 12,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "EwHiB9TFRGQX",
        "outputId": "00649dcf-2d48-4f49-b7db-54e6b2cc49b4"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Enter your MONGO URI: ··········\n"
          ]
        }
      ],
      "source": [
        "# Set MongoDB URI\n",
        "set_env_securely(\"MONGO_URI\", \"Enter your MONGO URI: \")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 13,
      "metadata": {
        "id": "BhqGjQf8RImo"
      },
      "outputs": [],
      "source": [
        "import pymongo\n",
        "\n",
        "\n",
        "def get_mongo_client(mongo_uri):\n",
        "    \"\"\"Establish and validate connection to the MongoDB.\"\"\"\n",
        "\n",
        "    client = pymongo.MongoClient(mongo_uri, appname=\"devrel.showcase.tavily_mongodb\")\n",
        "\n",
        "    # Validate the connection\n",
        "    ping_result = client.admin.command(\"ping\")\n",
        "    if ping_result.get(\"ok\") == 1.0:\n",
        "        # Connection successful\n",
        "        print(\"Connection to MongoDB successful\")\n",
        "        return client\n",
        "    print(\"Connection to MongoDB failed\")\n",
        "    return None\n",
        "\n",
        "\n",
        "MONGO_URI = os.environ[\"MONGO_URI\"]\n",
        "if not MONGO_URI:\n",
        "    print(\"MONGO_URI not set in environment variables\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 14,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "vxF489W6RJ4W",
        "outputId": "cf9dcf62-60a8-42c9-cc1f-a8ee902ae4f7"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Connection to MongoDB successful\n"
          ]
        }
      ],
      "source": [
        "mongo_client = get_mongo_client(MONGO_URI)\n",
        "\n",
        "DB_NAME = \"amazon_products\"\n",
        "COLLECTION_NAME = \"products\"\n",
        "\n",
        "# Create or get the database\n",
        "db = mongo_client[DB_NAME]\n",
        "\n",
        "# Create or get the collections\n",
        "product_collection = db[COLLECTION_NAME]"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 15,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "cRxY2bwbROnX",
        "outputId": "925dc36e-82c1-4781-bcf0-59c58c41e238"
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "DeleteResult({'n': 0, 'electionId': ObjectId('7fffffff0000000000000038'), 'opTime': {'ts': Timestamp(1731438198, 1), 't': 56}, 'ok': 1.0, '$clusterTime': {'clusterTime': Timestamp(1731438198, 1), 'signature': {'hash': b\",8\\xe2#{UQ\\xf3\\xc3\\xbc\\x91Q!\\x9a!\\xb7 \\x04'\\xfc\", 'keyId': 7390008424139849730}}, 'operationTime': Timestamp(1731438198, 1)}, acknowledged=True)"
            ]
          },
          "execution_count": 15,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "product_collection.delete_many({})"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "xUV4xC8PpM4I"
      },
      "source": [
        "This DataFrame is then converted into a list of dictionaries representing a product. The `insert_many()` method from the pymongo library is then used to efficiently insert these product documents into the MongoDB collection, named `products` within the `amazon_products` database. This crucial step establishes the foundation of the AI sales assistant's knowledge base, making the product data accessible for downstream retrieval and analysis processes.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 16,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "IWwLBvtURPyw",
        "outputId": "a48eb72f-c46e-4d1b-8276-c4669bf83e80"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Data ingestion into MongoDB completed\n"
          ]
        }
      ],
      "source": [
        "try:\n",
        "    documents = product_dataframe.to_dict(\"records\")\n",
        "    product_collection.insert_many(documents)\n",
        "\n",
        "    print(\"Data ingestion into MongoDB completed\")\n",
        "except Exception as e:\n",
        "    print(f\"Error during data ingestion into MongoDB: {e}\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "GFMe43-IRdtm"
      },
      "source": [
        "## Step 5: Vector Index Creation"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "alGOckhkpiuK"
      },
      "source": [
        "Retrieving data from MongoDB involves leveraging both traditional queries and vector search. For traditional queries, the pymongo library provides methods like `find_one()` and `find()` to retrieve documents based on specific criteria.\n",
        "\n",
        "MongoDB Atlas Vector Search is used for semantic-based retrieval. This feature allows for efficient similarity searches using the pre-calculated product embeddings. The system can retrieve products that are semantically similar to the query by querying the' embedding' field with a target embedding.\n",
        "\n",
        "This approach significantly enhances the AI sales assistant's ability to understand user intent and offer relevant product suggestions. Variables like `embedding_field_name` and `vector_search_index_name` are used to configure and interact with the vector search index within MongoDB, ensuring efficient retrieval of similar products.\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "0dS92oU7pkgA"
      },
      "source": [
        "Vector indexes also play a crucial role in enabling efficient semantic search within MongoDB. By creating a vector index on the 'embedding' field of the product documents, MongoDB can leverage the [HSNW algorithm](https://www.youtube.com/watch?v=AvCuiRs2cxw&ab_channel=MongoDB) to perform fast similarity searches. This means that when the AI sales assistant needs to find products similar to a user's query, MongoDB can quickly identify and retrieve the most relevant products based on their semantic embeddings. This significantly improves the system's ability to understand user intent and deliver accurate recommendations in real time.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 17,
      "metadata": {
        "id": "53aJ6lHGRhzN"
      },
      "outputs": [],
      "source": [
        "# The field containing the text embeddings on each document\n",
        "embedding_field_name = \"embedding\"\n",
        "# MongoDB Atlas Vector Search index name\n",
        "vector_search_index_name = \"vector_index\""
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 18,
      "metadata": {
        "id": "tyvhhOriRlWW"
      },
      "outputs": [],
      "source": [
        "import time\n",
        "\n",
        "from pymongo.operations import SearchIndexModel\n",
        "\n",
        "\n",
        "def setup_vector_search_index(collection, index_definition, index_name=\"vector_index\"):\n",
        "    \"\"\"\n",
        "    Setup a vector search index for a MongoDB collection and wait for 30 seconds.\n",
        "\n",
        "    Args:\n",
        "    collection: MongoDB collection object\n",
        "    index_definition: Dictionary containing the index definition\n",
        "    index_name: Name of the index (default: \"vector_index\")\n",
        "    \"\"\"\n",
        "    new_vector_search_index_model = SearchIndexModel(\n",
        "        definition=index_definition, name=index_name, type=\"vectorSearch\"\n",
        "    )\n",
        "\n",
        "    # Create the new index\n",
        "    try:\n",
        "        result = collection.create_search_index(model=new_vector_search_index_model)\n",
        "        print(f\"Creating index '{index_name}'...\")\n",
        "\n",
        "        # Sleep for 30 seconds\n",
        "        print(f\"Waiting for 30 seconds to allow index '{index_name}' to be created...\")\n",
        "        time.sleep(30)\n",
        "\n",
        "        print(f\"30-second wait completed for index '{index_name}'.\")\n",
        "        return result\n",
        "\n",
        "    except Exception as e:\n",
        "        print(f\"Error creating new vector search index '{index_name}': {e!s}\")\n",
        "        return None"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 19,
      "metadata": {
        "id": "RFCj-EliR5QS"
      },
      "outputs": [],
      "source": [
        "def create_vector_index_definition(dimensions):\n",
        "    return {\n",
        "        \"fields\": [\n",
        "            {\n",
        "                \"type\": \"vector\",\n",
        "                \"path\": \"embedding\",\n",
        "                \"numDimensions\": dimensions,\n",
        "                \"similarity\": \"cosine\",\n",
        "            }\n",
        "        ]\n",
        "    }"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 20,
      "metadata": {
        "id": "II1spYqLR77C"
      },
      "outputs": [],
      "source": [
        "DIMENSIONS = 1024\n",
        "vector_index_definition = create_vector_index_definition(dimensions=DIMENSIONS)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 21,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 88
        },
        "id": "saspIr2RSA4H",
        "outputId": "02fe108d-2842-424d-9249-c09661eb6146"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Creating index 'vector_index'...\n",
            "Waiting for 30 seconds to allow index 'vector_index' to be created...\n",
            "30-second wait completed for index 'vector_index'.\n"
          ]
        },
        {
          "data": {
            "application/vnd.google.colaboratory.intrinsic+json": {
              "type": "string"
            },
            "text/plain": [
              "'vector_index'"
            ]
          },
          "execution_count": 21,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "setup_vector_search_index(product_collection, vector_index_definition, \"vector_index\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "Xey9iTaon9fL"
      },
      "source": [
        "# Step 6 - 8: Setting up Tavily for working memory (short-term memory)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "UXIg6y0Mp3t0"
      },
      "source": [
        "The Tavily Hybrid RAG Client forms the core of the AI sales assistant's working memory, bridging the gap between the internal knowledge base stored in MongoDB and the vast external knowledge available online.\n",
        "\n",
        "Unlike traditional RAG systems that rely solely on retrieving documents, adding Tavily into our system introduces a hybrid approach, which combines information from local and foreign sources to provide comprehensive and context-aware responses. This is a form of HybridRAG, as we use two retrieval techniques to supplement information provided to an LLM.\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "DAV8Dpj-oMUQ"
      },
      "source": [
        "![image.png]()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "XLt9SdQfSNh9"
      },
      "source": [
        "## Step 6: Tavily Hybrid RAG Client setup​ (Working Memory)\n",
        "\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "mWINq5x_p-x3"
      },
      "source": [
        "The code snippet below initializes the Tavily Hybrid RAG Client, which is the core component responsible for implementing working memory in AI sales assistants. It imports necessary libraries (`pymongo` and `tavily`) and then creates an instance of the `TavilyHybridClient` class.\n",
        "\n",
        "During initialization, it configures the client with the Tavily API key, specifies MongoDB as the database provider, and provides references to the MongoDB collection, vector search index, embedding field, and content field.\n",
        "\n",
        "This setup establishes the connection between Tavily and the underlying knowledge base, enabling the client to perform a hybrid search and manage working memory effectively.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 22,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "2G4L9ZnlT33Q",
        "outputId": "39aa3ea5-4c7b-494f-8bf0-2f250f1ac9ba"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Enter your Tavily API Key: ··········\n"
          ]
        }
      ],
      "source": [
        "# Set up Tavily API Key\n",
        "set_env_securely(\"TAVILY_API_KEY\", \"Enter your Tavily API Key: \")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 23,
      "metadata": {
        "id": "cd61uqMfSNXq"
      },
      "outputs": [],
      "source": [
        "from tavily import TavilyHybridClient\n",
        "\n",
        "hybrid_rag = TavilyHybridClient(\n",
        "    api_key=os.environ.get(\"TAVILY_API_KEY\"),\n",
        "    db_provider=\"mongodb\",\n",
        "    collection=product_collection,\n",
        "    index=vector_search_index_name,\n",
        "    embeddings_field=\"embedding\",\n",
        "    content_field=\"product_semantics\",\n",
        ")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "wrD3na8mUO02"
      },
      "source": [
        "## Step 7: Retrieving Data From Working Memory (Real Time Search)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 24,
      "metadata": {
        "id": "YCNHoTmhUMc4"
      },
      "outputs": [],
      "source": [
        "results = hybrid_rag.search(\n",
        "    \"Get me a black laptop to use in a office\", max_local=5, max_foreign=2\n",
        ")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 25,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 269
        },
        "id": "MeQwt-5TUubm",
        "outputId": "e17f2c91-99ce-4536-e70d-198b4c8f8951"
      },
      "outputs": [
        {
          "data": {
            "application/vnd.google.colaboratory.intrinsic+json": {
              "summary": "{\n  \"name\": \"pd\",\n  \"rows\": 7,\n  \"fields\": [\n    {\n      \"column\": \"content\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 7,\n        \"samples\": [\n          \"Black Laptop Computers at Office Depot & OfficeMax. Shop today online, in store or buy online and pick up in stores.\",\n          \"Actual charge time will vary based on operating conditions. Measured at typical office ambient temperature of 23C. [9] Integrated smart card reader available only on Surface Laptop 6 for Business in Black in one of these configurations: 15 inch 5/16/512, 7/16/256, 7/16/512, 7/32/512 and only in US and Canada.\",\n          \"Wholesale Boutique Wool Floppy Hat Black Toys & Games | Dress Up & Pretend Play | Hats Make sure this fits by entering your model number. | 22\\\" around the head | Fabric content: 100% wool | 4\\\" brim size | Leather-like accent Hats off to adorable head wear! we have hats in many different colors sizes to suit every personality! these beautiful and trendy hats are a sure winner!. | 4 ounces (View shipping rates and policies) Wholesale Boutique Wool Floppy Hat - Black:  Perfect for pretend play! This stylish black floppy hat is made of soft wool, ideal for dress-up and imaginative role-playing.  Great for kids' parties, Halloween costumes, or everyday fun. Bulk buy now!\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"score\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 0.4628869067211406,\n        \"min\": 1.15203854e-07,\n        \"max\": 0.9982109,\n        \"num_unique_values\": 7,\n        \"samples\": [\n          0.9982109,\n          0.8951567,\n          2.3454339e-07\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"origin\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 2,\n        \"samples\": [\n          \"local\",\n          \"foreign\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}",
              "type": "dataframe"
            },
            "text/html": [
              "\n",
              "  <div id=\"df-7b82a7ac-5aa9-43e0-b63f-424790d2f285\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>content</th>\n",
              "      <th>score</th>\n",
              "      <th>origin</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>Black Laptop Computers at Office Depot &amp; Offic...</td>\n",
              "      <td>9.982109e-01</td>\n",
              "      <td>foreign</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>Actual charge time will vary based on operatin...</td>\n",
              "      <td>8.951567e-01</td>\n",
              "      <td>foreign</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>Dacasso Rosewood and Leather Desk Set, 10-Piec...</td>\n",
              "      <td>4.231559e-05</td>\n",
              "      <td>local</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>Barker Creek Chevron Black Tie Affair, 30-Coun...</td>\n",
              "      <td>2.501950e-06</td>\n",
              "      <td>local</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>Amscan 241143 Party Décor, Assorted Sizes, Bla...</td>\n",
              "      <td>4.280341e-07</td>\n",
              "      <td>local</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5</th>\n",
              "      <td>Wholesale Boutique Wool Floppy Hat Black Toys ...</td>\n",
              "      <td>2.345434e-07</td>\n",
              "      <td>local</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>6</th>\n",
              "      <td>3 Row - Black with White Game Card Box Toys &amp; ...</td>\n",
              "      <td>1.152039e-07</td>\n",
              "      <td>local</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-7b82a7ac-5aa9-43e0-b63f-424790d2f285')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-7b82a7ac-5aa9-43e0-b63f-424790d2f285 button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-7b82a7ac-5aa9-43e0-b63f-424790d2f285');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "<div id=\"df-17a121bf-bd62-46be-83be-7f841f3d9a7c\">\n",
              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-17a121bf-bd62-46be-83be-7f841f3d9a7c')\"\n",
              "            title=\"Suggest charts\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "  </button>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "      --bg-color: #E8F0FE;\n",
              "      --fill-color: #1967D2;\n",
              "      --hover-bg-color: #E2EBFA;\n",
              "      --hover-fill-color: #174EA6;\n",
              "      --disabled-fill-color: #AAA;\n",
              "      --disabled-bg-color: #DDD;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "      --bg-color: #3B4455;\n",
              "      --fill-color: #D2E3FC;\n",
              "      --hover-bg-color: #434B5C;\n",
              "      --hover-fill-color: #FFFFFF;\n",
              "      --disabled-bg-color: #3B4455;\n",
              "      --disabled-fill-color: #666;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart {\n",
              "    background-color: var(--bg-color);\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: var(--fill-color);\n",
              "    height: 32px;\n",
              "    padding: 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: var(--hover-bg-color);\n",
              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: var(--button-hover-fill-color);\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart-complete:disabled,\n",
              "  .colab-df-quickchart-complete:disabled:hover {\n",
              "    background-color: var(--disabled-bg-color);\n",
              "    fill: var(--disabled-fill-color);\n",
              "    box-shadow: none;\n",
              "  }\n",
              "\n",
              "  .colab-df-spinner {\n",
              "    border: 2px solid var(--fill-color);\n",
              "    border-color: transparent;\n",
              "    border-bottom-color: var(--fill-color);\n",
              "    animation:\n",
              "      spin 1s steps(1) infinite;\n",
              "  }\n",
              "\n",
              "  @keyframes spin {\n",
              "    0% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "      border-left-color: var(--fill-color);\n",
              "    }\n",
              "    20% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    30% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    40% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    60% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    80% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "    90% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "  }\n",
              "</style>\n",
              "\n",
              "  <script>\n",
              "    async function quickchart(key) {\n",
              "      const quickchartButtonEl =\n",
              "        document.querySelector('#' + key + ' button');\n",
              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
              "      try {\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      } catch (error) {\n",
              "        console.error('Error during call to suggestCharts:', error);\n",
              "      }\n",
              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
              "    }\n",
              "    (() => {\n",
              "      let quickchartButtonEl =\n",
              "        document.querySelector('#df-17a121bf-bd62-46be-83be-7f841f3d9a7c button');\n",
              "      quickchartButtonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "    })();\n",
              "  </script>\n",
              "</div>\n",
              "\n",
              "    </div>\n",
              "  </div>\n"
            ],
            "text/plain": [
              "                                             content         score   origin\n",
              "0  Black Laptop Computers at Office Depot & Offic...  9.982109e-01  foreign\n",
              "1  Actual charge time will vary based on operatin...  8.951567e-01  foreign\n",
              "2  Dacasso Rosewood and Leather Desk Set, 10-Piec...  4.231559e-05    local\n",
              "3  Barker Creek Chevron Black Tie Affair, 30-Coun...  2.501950e-06    local\n",
              "4  Amscan 241143 Party Décor, Assorted Sizes, Bla...  4.280341e-07    local\n",
              "5  Wholesale Boutique Wool Floppy Hat Black Toys ...  2.345434e-07    local\n",
              "6  3 Row - Black with White Game Card Box Toys & ...  1.152039e-07    local"
            ]
          },
          "execution_count": 25,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "# Create dataframe from the result and view as table\n",
        "pd.DataFrame(results)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "iiQCmQGXWLTv"
      },
      "source": [
        "## Step 8: Save Short Term Memory Content to Long Term Memory"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "FuW_cy9gs9rw"
      },
      "source": [
        "There are scenarios where storing new information from the working memory into a long-term memory component within a system is required.\n",
        "\n",
        "For example. let's assume the user asks for \"a black laptop with a long battery life for office use.\" Tavily might retrieve information about a specific laptop model with long battery life from an external website. By saving this foreign data, the next time a user asks for a \"laptop with long battery life\", the AI sales assistant can directly retrieve the previously saved information from its local knowledge base, providing a faster and more efficient response.\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "aiw2JNvds_v-"
      },
      "source": [
        "Below are a few more benefits and rationale for saving foreign data from working memory:\n",
        "\n",
        "- Enriched Knowledge Base: By saving foreign data, the AI sales assistant's knowledge base becomes more comprehensive and up-to-date with information from the web. This can significantly improve the relevance and accuracy of future responses.\n",
        "- Reduced Latency: Subsequent searches for similar queries will be faster as the relevant information is now available locally, eliminating the need to query external sources again. This also reduced the operational cost of the entire system.\n",
        "- Offline Access: If external sources become unavailable, the AI sales assistant can still provide answers based on the previously saved foreign data, ensuring continuity of service."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 26,
      "metadata": {
        "id": "MKjvDgFDU1m7"
      },
      "outputs": [],
      "source": [
        "results = hybrid_rag.search(\n",
        "    \"Get me a black laptop to use in a office\",\n",
        "    max_local=5,\n",
        "    max_foreign=2,\n",
        "    save_foreign=True,\n",
        ")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 27,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 269
        },
        "id": "p5nQlU5EWZ1G",
        "outputId": "46d8e235-cd19-4ccc-e56d-9aa0fb43aee0"
      },
      "outputs": [
        {
          "data": {
            "application/vnd.google.colaboratory.intrinsic+json": {
              "summary": "{\n  \"name\": \"pd\",\n  \"rows\": 7,\n  \"fields\": [\n    {\n      \"column\": \"content\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 7,\n        \"samples\": [\n          \"Black Dell Laptops and 2-in-1 PCs Black Dell Laptops and 2-in-1 PCs Features of Black Dell Laptops and 2-in-1 PCs: Dell offers more business laptop and mobile workstation models and form factors, more monitor models and more options to customize device configuration than Apple\\u00b9\\u00b9. Based on May 2024 Stratetgic Thermal Lab report commissioned by Dell Technologies using Cinebench 2024 Multi-Core, 10-minute-stress test - April 2024 comparing Internal Test Data with XPS 13, Qualcomm Snapdragon X Elite - X1E80100, Qualcomm Adreno graphics, 64GB memory, 2TB SSD vs. For supported system and requirements, please refer to our user guide (SupportAssist for Home PCs version for personal use) or administrator guide (SupportAssist for Business PCs version for PC fleet management) and select supported PCs. Proactive and predictive capabilities depend upon your active service plan and Dell Technologies business rules.\",\n          \"HP Stream 14\\\" HD BrightView Laptop, Intel Celeron N4120, 16GB RAM, 288GB Storage (128GB eMMC + 160GB Docking Station Set), Intel UHD Graphics, 720p Webcam, Wi-Fi, 1 Year Office 365, Win 11 S, Black\",\n          \"Wholesale Boutique Wool Floppy Hat Black Toys & Games | Dress Up & Pretend Play | Hats Make sure this fits by entering your model number. | 22\\\" around the head | Fabric content: 100% wool | 4\\\" brim size | Leather-like accent Hats off to adorable head wear! we have hats in many different colors sizes to suit every personality! these beautiful and trendy hats are a sure winner!. | 4 ounces (View shipping rates and policies) Wholesale Boutique Wool Floppy Hat - Black:  Perfect for pretend play! This stylish black floppy hat is made of soft wool, ideal for dress-up and imaginative role-playing.  Great for kids' parties, Halloween costumes, or everyday fun. Bulk buy now!\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"score\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 0.26210157686248603,\n        \"min\": 1.15203854e-07,\n        \"max\": 0.7009972,\n        \"num_unique_values\": 7,\n        \"samples\": [\n          0.7009972,\n          0.0607519,\n          2.3271815e-07\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"origin\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 2,\n        \"samples\": [\n          \"local\",\n          \"foreign\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}",
              "type": "dataframe"
            },
            "text/html": [
              "\n",
              "  <div id=\"df-31f64af9-a1a1-4311-ba54-19b4ed415e92\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>content</th>\n",
              "      <th>score</th>\n",
              "      <th>origin</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>Black Dell Laptops and 2-in-1 PCs Black Dell L...</td>\n",
              "      <td>7.009972e-01</td>\n",
              "      <td>foreign</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>HP Stream 14\" HD BrightView Laptop, Intel Cele...</td>\n",
              "      <td>6.075190e-02</td>\n",
              "      <td>foreign</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>Dacasso Rosewood and Leather Desk Set, 10-Piec...</td>\n",
              "      <td>4.231559e-05</td>\n",
              "      <td>local</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>Barker Creek Chevron Black Tie Affair, 30-Coun...</td>\n",
              "      <td>2.501950e-06</td>\n",
              "      <td>local</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>Amscan 241143 Party Décor, Assorted Sizes, Bla...</td>\n",
              "      <td>4.247031e-07</td>\n",
              "      <td>local</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5</th>\n",
              "      <td>Wholesale Boutique Wool Floppy Hat Black Toys ...</td>\n",
              "      <td>2.327181e-07</td>\n",
              "      <td>local</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>6</th>\n",
              "      <td>3 Row - Black with White Game Card Box Toys &amp; ...</td>\n",
              "      <td>1.152039e-07</td>\n",
              "      <td>local</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-31f64af9-a1a1-4311-ba54-19b4ed415e92')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-31f64af9-a1a1-4311-ba54-19b4ed415e92 button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-31f64af9-a1a1-4311-ba54-19b4ed415e92');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "<div id=\"df-e79f7be2-6a2f-4aa9-a49c-c1ece486fdfc\">\n",
              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-e79f7be2-6a2f-4aa9-a49c-c1ece486fdfc')\"\n",
              "            title=\"Suggest charts\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "  </button>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "      --bg-color: #E8F0FE;\n",
              "      --fill-color: #1967D2;\n",
              "      --hover-bg-color: #E2EBFA;\n",
              "      --hover-fill-color: #174EA6;\n",
              "      --disabled-fill-color: #AAA;\n",
              "      --disabled-bg-color: #DDD;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "      --bg-color: #3B4455;\n",
              "      --fill-color: #D2E3FC;\n",
              "      --hover-bg-color: #434B5C;\n",
              "      --hover-fill-color: #FFFFFF;\n",
              "      --disabled-bg-color: #3B4455;\n",
              "      --disabled-fill-color: #666;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart {\n",
              "    background-color: var(--bg-color);\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: var(--fill-color);\n",
              "    height: 32px;\n",
              "    padding: 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: var(--hover-bg-color);\n",
              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: var(--button-hover-fill-color);\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart-complete:disabled,\n",
              "  .colab-df-quickchart-complete:disabled:hover {\n",
              "    background-color: var(--disabled-bg-color);\n",
              "    fill: var(--disabled-fill-color);\n",
              "    box-shadow: none;\n",
              "  }\n",
              "\n",
              "  .colab-df-spinner {\n",
              "    border: 2px solid var(--fill-color);\n",
              "    border-color: transparent;\n",
              "    border-bottom-color: var(--fill-color);\n",
              "    animation:\n",
              "      spin 1s steps(1) infinite;\n",
              "  }\n",
              "\n",
              "  @keyframes spin {\n",
              "    0% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "      border-left-color: var(--fill-color);\n",
              "    }\n",
              "    20% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    30% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    40% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    60% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    80% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "    90% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "  }\n",
              "</style>\n",
              "\n",
              "  <script>\n",
              "    async function quickchart(key) {\n",
              "      const quickchartButtonEl =\n",
              "        document.querySelector('#' + key + ' button');\n",
              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
              "      try {\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      } catch (error) {\n",
              "        console.error('Error during call to suggestCharts:', error);\n",
              "      }\n",
              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
              "    }\n",
              "    (() => {\n",
              "      let quickchartButtonEl =\n",
              "        document.querySelector('#df-e79f7be2-6a2f-4aa9-a49c-c1ece486fdfc button');\n",
              "      quickchartButtonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "    })();\n",
              "  </script>\n",
              "</div>\n",
              "\n",
              "    </div>\n",
              "  </div>\n"
            ],
            "text/plain": [
              "                                             content         score   origin\n",
              "0  Black Dell Laptops and 2-in-1 PCs Black Dell L...  7.009972e-01  foreign\n",
              "1  HP Stream 14\" HD BrightView Laptop, Intel Cele...  6.075190e-02  foreign\n",
              "2  Dacasso Rosewood and Leather Desk Set, 10-Piec...  4.231559e-05    local\n",
              "3  Barker Creek Chevron Black Tie Affair, 30-Coun...  2.501950e-06    local\n",
              "4  Amscan 241143 Party Décor, Assorted Sizes, Bla...  4.247031e-07    local\n",
              "5  Wholesale Boutique Wool Floppy Hat Black Toys ...  2.327181e-07    local\n",
              "6  3 Row - Black with White Game Card Box Toys & ...  1.152039e-07    local"
            ]
          },
          "execution_count": 27,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "pd.DataFrame(results)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "drrKPgTlWo4V"
      },
      "source": [
        "Take note that the item with the content:\n",
        "\n",
        "- \"Black Dell Laptops and 2-in-1 PCs Black Dell L...\"\n",
        "- \"HP Stream 14\" HD BrightView Laptop, Intel Cele...\"\n",
        "\n",
        "are both sourced from the internet or a \"foreign\" source"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 28,
      "metadata": {
        "id": "CgB_NMZIWa0-"
      },
      "outputs": [],
      "source": [
        "results = hybrid_rag.search(\n",
        "    \"Get me a black laptop to use in a office\",\n",
        "    max_local=5,\n",
        "    max_foreign=2,\n",
        "    save_foreign=True,\n",
        ")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 29,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 269
        },
        "id": "N7I9uFHHWfZ3",
        "outputId": "1fd35590-9149-4388-956f-34d029111c8f"
      },
      "outputs": [
        {
          "data": {
            "application/vnd.google.colaboratory.intrinsic+json": {
              "summary": "{\n  \"name\": \"pd\",\n  \"rows\": 7,\n  \"fields\": [\n    {\n      \"column\": \"content\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 7,\n        \"samples\": [\n          \"Buy Black Business Laptops at Staples and get Free next-day delivery when you spend $35+.\",\n          \"Black Dell Laptops and 2-in-1 PCs Black Dell Laptops and 2-in-1 PCs Features of Black Dell Laptops and 2-in-1 PCs: Dell offers more business laptop and mobile workstation models and form factors, more monitor models and more options to customize device configuration than Apple\\u00b9\\u00b9. Based on May 2024 Stratetgic Thermal Lab report commissioned by Dell Technologies using Cinebench 2024 Multi-Core, 10-minute-stress test - April 2024 comparing Internal Test Data with XPS 13, Qualcomm Snapdragon X Elite - X1E80100, Qualcomm Adreno graphics, 64GB memory, 2TB SSD vs. For supported system and requirements, please refer to our user guide (SupportAssist for Home PCs version for personal use) or administrator guide (SupportAssist for Business PCs version for PC fleet management) and select supported PCs. Proactive and predictive capabilities depend upon your active service plan and Dell Technologies business rules.\",\n          \"Barker Creek Chevron Black Tie Affair, 30-Count, Self-Adhesive (LL-1233) Toys & Games | Arts & Crafts | Stickers Make sure this fits by entering your model number. | 30 per pack | Will hold standard 3 x 5 Inches Index Cards | Peel & Stick 3-1/2 x 5-1/8 Inches | Coordinates with Black Tie products. show up to 2 reviews by default You'll discover countless ways to use Barker Creek's handy Library Pockets. These versatile little work horses are sized perfectly for use with standard 3 by 5-inch index cards. Each pocket has a pre-printed \\\"label\\\" on the front so you can personalize them with staff or student names, presentation dates, list their contents or note other helpful information. Two self-adhesive peel & stick strips are on the back of the pockets so you can easily adhere them to charts, file folders, binders, and more. Each package includes 30 pockets -- ten each of three colorful designs. Here are a few suggested uses for Barker Creek's Library Pockets: Use them to hold time cards, flash cards, assignments, reading logs, suggestions, brainstorming ideas, and hall passes. Adhere them to the front of binders and file folders and insert tables of contents, agendas, schedules, outlines, or blank index cards for taking notes. Adhere them to a chart and insert photos of staff or class members. Adhere them to the inside front cover of your office or classroom library books and use index cards to track books that are being borrowed. Write names of meeting or event attendees on the preprinted label , insert a name badge, pen, your business card, and a few index cards for note taking and hand them out as attendees arrive or place them on chairs to assign seating. The possibilities are limited only by your imagination! Coordinating products, including name badges and file folders, are available. Find them by searching: Barker Creek Chevron. | Brand Name BARKER CREEK Item Weight 0.32 ounces Product Dimensions 9 x 3.5 x 0.8 inches Item model number LL-1233 Color Black&white Material Type paper Number of Items 1 Manufacturer Part Number LL-1233 | 0.32 ounces (View shipping rates and policies) 30-Count Barker Creek Chevron Black Tie Affair Stickers (LL-1233):  Self-adhesive, perfect for crafting, scrapbooking, or adding a touch of elegance to any project.  Great for kids & adults! #stickers #crafts #scrapbooking #barkercreek\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"score\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 0.4121007616526531,\n        \"min\": 4.2803413e-07,\n        \"max\": 0.998103,\n        \"num_unique_values\": 7,\n        \"samples\": [\n          0.998103,\n          0.6999727,\n          2.5019503e-06\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"origin\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 2,\n        \"samples\": [\n          \"local\",\n          \"foreign\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}",
              "type": "dataframe"
            },
            "text/html": [
              "\n",
              "  <div id=\"df-b9c3f24f-b329-4bbd-a679-174aa59ee81d\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>content</th>\n",
              "      <th>score</th>\n",
              "      <th>origin</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>Buy Black Business Laptops at Staples and get ...</td>\n",
              "      <td>9.981030e-01</td>\n",
              "      <td>foreign</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>Black Dell Laptops and 2-in-1 PCs Black Dell L...</td>\n",
              "      <td>6.999727e-01</td>\n",
              "      <td>local</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>ASUS 2022 Laptop L210 11.6\" Ultra Thin Student...</td>\n",
              "      <td>6.465349e-02</td>\n",
              "      <td>foreign</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>HP Stream 14\" HD BrightView Laptop, Intel Cele...</td>\n",
              "      <td>6.086345e-02</td>\n",
              "      <td>local</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>Dacasso Rosewood and Leather Desk Set, 10-Piec...</td>\n",
              "      <td>4.231559e-05</td>\n",
              "      <td>local</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5</th>\n",
              "      <td>Barker Creek Chevron Black Tie Affair, 30-Coun...</td>\n",
              "      <td>2.501950e-06</td>\n",
              "      <td>local</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>6</th>\n",
              "      <td>Amscan 241143 Party Décor, Assorted Sizes, Bla...</td>\n",
              "      <td>4.280341e-07</td>\n",
              "      <td>local</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-b9c3f24f-b329-4bbd-a679-174aa59ee81d')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-b9c3f24f-b329-4bbd-a679-174aa59ee81d button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-b9c3f24f-b329-4bbd-a679-174aa59ee81d');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "<div id=\"df-cecea3f6-988f-4d3d-829e-78b0cc0ab88a\">\n",
              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-cecea3f6-988f-4d3d-829e-78b0cc0ab88a')\"\n",
              "            title=\"Suggest charts\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "  </button>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "      --bg-color: #E8F0FE;\n",
              "      --fill-color: #1967D2;\n",
              "      --hover-bg-color: #E2EBFA;\n",
              "      --hover-fill-color: #174EA6;\n",
              "      --disabled-fill-color: #AAA;\n",
              "      --disabled-bg-color: #DDD;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "      --bg-color: #3B4455;\n",
              "      --fill-color: #D2E3FC;\n",
              "      --hover-bg-color: #434B5C;\n",
              "      --hover-fill-color: #FFFFFF;\n",
              "      --disabled-bg-color: #3B4455;\n",
              "      --disabled-fill-color: #666;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart {\n",
              "    background-color: var(--bg-color);\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: var(--fill-color);\n",
              "    height: 32px;\n",
              "    padding: 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: var(--hover-bg-color);\n",
              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: var(--button-hover-fill-color);\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart-complete:disabled,\n",
              "  .colab-df-quickchart-complete:disabled:hover {\n",
              "    background-color: var(--disabled-bg-color);\n",
              "    fill: var(--disabled-fill-color);\n",
              "    box-shadow: none;\n",
              "  }\n",
              "\n",
              "  .colab-df-spinner {\n",
              "    border: 2px solid var(--fill-color);\n",
              "    border-color: transparent;\n",
              "    border-bottom-color: var(--fill-color);\n",
              "    animation:\n",
              "      spin 1s steps(1) infinite;\n",
              "  }\n",
              "\n",
              "  @keyframes spin {\n",
              "    0% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "      border-left-color: var(--fill-color);\n",
              "    }\n",
              "    20% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    30% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    40% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    60% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    80% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "    90% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "  }\n",
              "</style>\n",
              "\n",
              "  <script>\n",
              "    async function quickchart(key) {\n",
              "      const quickchartButtonEl =\n",
              "        document.querySelector('#' + key + ' button');\n",
              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
              "      try {\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      } catch (error) {\n",
              "        console.error('Error during call to suggestCharts:', error);\n",
              "      }\n",
              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
              "    }\n",
              "    (() => {\n",
              "      let quickchartButtonEl =\n",
              "        document.querySelector('#df-cecea3f6-988f-4d3d-829e-78b0cc0ab88a button');\n",
              "      quickchartButtonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "    })();\n",
              "  </script>\n",
              "</div>\n",
              "\n",
              "    </div>\n",
              "  </div>\n"
            ],
            "text/plain": [
              "                                             content         score   origin\n",
              "0  Buy Black Business Laptops at Staples and get ...  9.981030e-01  foreign\n",
              "1  Black Dell Laptops and 2-in-1 PCs Black Dell L...  6.999727e-01    local\n",
              "2  ASUS 2022 Laptop L210 11.6\" Ultra Thin Student...  6.465349e-02  foreign\n",
              "3  HP Stream 14\" HD BrightView Laptop, Intel Cele...  6.086345e-02    local\n",
              "4  Dacasso Rosewood and Leather Desk Set, 10-Piec...  4.231559e-05    local\n",
              "5  Barker Creek Chevron Black Tie Affair, 30-Coun...  2.501950e-06    local\n",
              "6  Amscan 241143 Party Décor, Assorted Sizes, Bla...  4.280341e-07    local"
            ]
          },
          "execution_count": 29,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "pd.DataFrame(results)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "KIo31V3kW8Co"
      },
      "source": [
        "Observe that included in the \"local\" sourced results are search results that were once \"foreign\".\n",
        "\n",
        "Items from used in the working memory, has been moved to the long term memory"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "ZYN0rvX4qTM6"
      },
      "source": [
        "![image.png]()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "WtJRg9V9qY06"
      },
      "source": [
        "## Benefits of Working Memory For AI Agents and Agentic Systems\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "B1AvVF1wsrdF"
      },
      "source": [
        "![image.png]()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "aokvO8XGqeEy"
      },
      "source": [
        "Working memory, enabled by Tavily and MongoDB in your AI application stack, offers several key benefits for LLM-powered chatbots, AI agents, and agentic systems, including AI-powered sales assistants:\n",
        "\n",
        "1. Enhanced Context and Personalization: AI agents can remember past interactions and user preferences, allowing them to provide more contextually relevant and personalized responses. This is demonstrated in the code through the use of the Tavily Hybrid RAG Client, which stores and retrieves information from both local and foreign sources, allowing the system to recall past interactions.\n",
        "\n",
        "2. Improved Efficiency and Speed: Working memory allows AI agents to access previously retrieved information quickly, reducing the need for repeated external queries. This is evident in the code where the `save_foreign=True` parameter enables saving foreign data into the local knowledge base, accelerating future searches for similar information.\n",
        "\n",
        "3. Increased Knowledge Base and Adaptability: By saving foreign data, AI agents can continuously expand their knowledge base, learning from new interactions and adapting to evolving user needs. This is reflected in the code's use of MongoDB as a long-term memory store, enabling the system to build a more comprehensive knowledge base over time.\n",
        "\n",
        "4. Enhanced User Experience: Working memory enables more natural and engaging interactions, as AI agents can understand and respond to user queries with greater context and personalization. This is a crucial benefit highlighted in the AI sales assistant use case, where remembering past interactions leads to more satisfying customer experiences.\n",
        "\n",
        "Overall, working memory empowers AI agents and agentic systems to become more intelligent, adaptable, reliable, and user-centric, significantly improving their adoption, effectiveness, and overall user experience.\n"
      ]
    }
  ],
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    },
    "language_info": {
      "name": "python"
    },
    "widgets": {
      "application/vnd.jupyter.widget-state+json": {
        "01cc65a3953a4b34b469677d2e4586c1": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HTMLModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_5c4b00ddb5eb4d6b978ee97d645d481b",
            "placeholder": "​",
            "style": "IPY_MODEL_863c775bee6a47c7b429f813e08803cc",
            "value": "Generating train split: 100%"
          }
        },
        "042dbe05d19e4919967c1366916a583e": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HTMLModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_98751af9ec044b49bc3500746c368250",
            "placeholder": "​",
            "style": "IPY_MODEL_51576a1a30c4418dabb6707d892b9c20",
            "value": " 1.22k/1.22k [00:00&lt;00:00, 52.1kB/s]"
          }
        },
        "1a677d8c742f41199f3722106af9e502": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "252d592fa8824ae4a5b0b1290d16ea2f": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "ProgressStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "26eedaf3e495447096ce07baa240abff": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HBoxModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_01cc65a3953a4b34b469677d2e4586c1",
              "IPY_MODEL_5ce3e46314a44be4a34ddd923481d565",
              "IPY_MODEL_fcbf37955ff4400291a0d12a207894bf"
            ],
            "layout": "IPY_MODEL_4a072aadd74c44058b4dda184bf86895"
          }
        },
        "26f07715f73d49ec89c343344f6ac524": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "2bbab14bd521455fa92486ed73b860c8": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "ProgressStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "32ec681e47ca4741b691c2be054cb05d": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "FloatProgressModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_571ed4dfb9134f6b8b2d82648d7b81d6",
            "max": 1221,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_2bbab14bd521455fa92486ed73b860c8",
            "value": 1221
          }
        },
        "3ac0b9d8f1b24766b044efd7061e0e65": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HBoxModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_9df90dab7338463a899ffcf4d098982f",
              "IPY_MODEL_32ec681e47ca4741b691c2be054cb05d",
              "IPY_MODEL_042dbe05d19e4919967c1366916a583e"
            ],
            "layout": "IPY_MODEL_4bfaf6a7e6b146588549f31dd5b6fc83"
          }
        },
        "4a072aadd74c44058b4dda184bf86895": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "4bfaf6a7e6b146588549f31dd5b6fc83": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "51576a1a30c4418dabb6707d892b9c20": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "5584ff6199d74edba7e9b6d5ad98ca69": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "571ed4dfb9134f6b8b2d82648d7b81d6": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "5af88ae742284399a8bac4c0918e33ef": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "5c4b00ddb5eb4d6b978ee97d645d481b": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "5ce3e46314a44be4a34ddd923481d565": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "FloatProgressModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_cbefa1f46015406891bdfa2749b3d7a0",
            "max": 1345,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_252d592fa8824ae4a5b0b1290d16ea2f",
            "value": 1345
          }
        },
        "74792adbb4864b21b8fe2f3305406d9c": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "863c775bee6a47c7b429f813e08803cc": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "87432b4fc6de43c0b0ac598e045bab74": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "91283d8c4adb4f3ea1939505201a6563": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HTMLModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_de9f69c89446426eac8497c42bc94c0a",
            "placeholder": "​",
            "style": "IPY_MODEL_26f07715f73d49ec89c343344f6ac524",
            "value": " 47.6M/47.6M [00:01&lt;00:00, 29.2MB/s]"
          }
        },
        "98751af9ec044b49bc3500746c368250": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "9943caecde394b19b5989fecd20539f2": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "9a1a9bfaf4234a0890ea1ab141e689dc": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "FloatProgressModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_74792adbb4864b21b8fe2f3305406d9c",
            "max": 47605703,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_c9c22ba89f3b41bd90c61335553a52f9",
            "value": 47605703
          }
        },
        "9df90dab7338463a899ffcf4d098982f": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HTMLModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_5584ff6199d74edba7e9b6d5ad98ca69",
            "placeholder": "​",
            "style": "IPY_MODEL_87432b4fc6de43c0b0ac598e045bab74",
            "value": "README.md: 100%"
          }
        },
        "c408cf02f8af4954a20e386fab678ea9": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HBoxModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_e2f8f33832cf44cca1c3183f0f94d62c",
              "IPY_MODEL_9a1a9bfaf4234a0890ea1ab141e689dc",
              "IPY_MODEL_91283d8c4adb4f3ea1939505201a6563"
            ],
            "layout": "IPY_MODEL_fea121b36bbc48fa9169753b8a510c06"
          }
        },
        "c9c22ba89f3b41bd90c61335553a52f9": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "ProgressStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "cbefa1f46015406891bdfa2749b3d7a0": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "d70272f6047749fcb47ab329bae024dd": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "DescriptionStyleModel",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "de9f69c89446426eac8497c42bc94c0a": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "e2f8f33832cf44cca1c3183f0f94d62c": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HTMLModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_9943caecde394b19b5989fecd20539f2",
            "placeholder": "​",
            "style": "IPY_MODEL_d70272f6047749fcb47ab329bae024dd",
            "value": "train-00000-of-00001.parquet: 100%"
          }
        },
        "fcbf37955ff4400291a0d12a207894bf": {
          "model_module": "@jupyter-widgets/controls",
          "model_module_version": "1.5.0",
          "model_name": "HTMLModel",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_5af88ae742284399a8bac4c0918e33ef",
            "placeholder": "​",
            "style": "IPY_MODEL_1a677d8c742f41199f3722106af9e502",
            "value": " 1345/1345 [00:00&lt;00:00, 2818.28 examples/s]"
          }
        },
        "fea121b36bbc48fa9169753b8a510c06": {
          "model_module": "@jupyter-widgets/base",
          "model_module_version": "1.2.0",
          "model_name": "LayoutModel",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "state": {}
      }
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}
